React4xp Lib icon

React4xp Lib

Server-side React rendering integrated with XP components

Screenshots

  • React4xp Lib screenshot 0

This (lib-react4xp) is a library of services and utility functions that makes Enonic XP play nice with React. Specifically, it provides out of the box:

  • XP controller functions that make it easy to blend React into XP components with minimal boilerplate code,
  • Serve pre-compiled (*) React components and their dependency scripts to the browser, as well as providing a client-side rendering wrapper and (optionally and adjustably) React and ReactDOM themselves,
  • Automatic dependency/chunk handling, and response headers that ensure efficient client-side caching of components and dependencies.
  • Server-side rendering (SSR): optional and configurable (*)


Note: this requires a specific compiled file structure in runtime. This library does not provide that - but there are companion NPM packages tailored for making the build process seamless and easy.

See the documentation for complete install instructions - or use the react4xp-starter in Enonic Market for an easier start. Internet Explorer support: no (but Edge: yes).

Releases

  1. 5.0.0

    • Build-time restrictions on importing from site and entryDirs
    • Compatibility:

      • 7.12.0
  2. 4.0.1

    • Bug fixed: Code still referenced Nashorn API directly
    • Compatibility:

      • 7.12.0
  3. 4.0.0

    • Graal.JS
    • TypeScript
    • React 18
    • Named exports
    • Globals
    • Lazy loading
    • Client-side Components (MUI)
    • New params hydrate and ssr
    • Application Configuration for hydrate and ssr
    • Multiple React4xp app on same page
    • Content Studio inline mode navigation
    • Build improvements
    • Polyfill improvements
    • Compatibility:

      • 7.12.0
  4. 3.4.2

    • Bug fixes
    • Compatibility:

      • 7.6.0
  5. 3.4.1

    • html parser adds unnecessary closing tags
    • Compatibility:

      • 7.6.0
  6. 3.4.0

    • Invoke function instead of eval
    • Polyfill setTimeout
    • htmlParser must support html
    • replace org.json dependency
    • Compatibility:

      • 7.6.0
  7. 3.3.0

    • Upgraded Enonic NPM library
    • Compatibility:

      • 7.6.0
  8. 3.2.1

    • Fixed dependencies
    • Compatibility:

      • 7.6.0
  9. 3.2.0

    • Improved performance when running in Nashorn
    • Compatibility:

      • 7.6.0
  10. 3.1.0

    • Enable usage of GraalJS for server-side rendering
    • Compatibility:

      • 7.6.0
  11. 3.0.1

    • * Fix a bug related to asset urls
    • Compatibility:

      • 7.6.0
  12. 3.0.0

    • lib-static used to serve immuteable assets
    • Inline script removed, in preparation for Enonic XP 7.9.0 Content Security Policy
    • Support React 18 which required more polyfills for Nashorn
    • Build system rewritten (see upgrade doc):
    • - Npm module renamed react4xp -> @enonic/react4xp
    • - Npm module renamed react4xp-regions -> @enonic/react-components
    • - Settings file renamed react4xp.properties -> react4xp.config.js
    • - Runtime settings moved to the Application configuration file
    • Compatibility:

      • 7.6.0
  13. 2.1.0

    • Normalizes the service URLs that are generated and used behind the scenes by the react4xp runtime, fixing an occasional bug and making behavior more predictable
    • Compatibility:

      • 7.6.0
  14. 2.0.2

    • Fixes bug: updates build dependencies which could break builds using the library
    • Compatibility:

      • 7.6.0
  15. 2.0.1

    • Fixed bug: "BUILD_ENV not defined"
    • Compatibility:

      • 7.6.0
  16. 2.0.0

    • Update to webpack 5 (and webpack-CLI 4, and react4xp NPM package 2.0.0).
    • MAJOR compatibility change: for webpack-4-based projects, use version 1.x of both the lib and the react4xp NPM package.
    • Compatibility:

      • 7.6.0
  17. 1.7.1

    • Fixed bug: nashorn engine no longer fails to initialize in XP 7.7+
    • Compatibility:

      • 7.6.0
  18. 1.7.0

    • Feature: Object.assign is polyfilled in the nashorn SSR engine
    • Fixed a bug where using renderBody and renderPageContributions without submitting request, could cause an entry to not be react-activated in the client
    • Compatibility:

      • 7.6.0
  19. 1.6.0

    • Bugfix: nashorn caching is no longer the default for SSR, but must be switched on in react4xp.properties if needed (but it's recommended to keep it switched off). This requires using this lib in combination with npm package react4xp 1.5.7 or later.
    • Improvements to react component error handling and reporting: error message containers are trimmed down; messages and solution tips are now moved to messages in the browser console. Server-side errors during .renderPageContributions will have containers of their own.
    • When using "custom flow" (.renderBody and .renderPageContributions), an optional request parameter can be added, the same way as in .render. This adds handling of XP view mode and error reporting: always-SSR rendering inside Content Studio (as is recommended). And in live view mode, server-side error messages are withheld from the error containers.
    • Error message containers are rendered for .renderPageContributions problems.
    • Compatibility:

      • 7.6.0
  20. 1.5.0

    • Multi-thread concurrent support on SSR engine. Should both yield a performance increase on simultaneous SSR calls, and fix bugs.
    • Unified runtime resource reading to conform with existing XP approaches.
    • Compatibility:

      • 7.6.0
  21. 1.4.0

    • Configurable SSR lazy-loading and engine settings. Improved error handling. NPM dependency updates.
    • Compatibility:

      • 7.6.0
  22. 1.0.2

    • Updated dependencies and docs
    • Compatibility:

      • 7.3.0
  23. 1.0.1

    • Fixing a bug in the initial release 1.0.0
    • Compatibility:

      • 7.3.0
  24. 0.3.3

    • XP7 version (beta)
    • Compatibility:

      • 7.0.0
  25. 0.2.3

    • XP6 version (beta)
    • Compatibility:

      • 6.15.0