React version update to 18.2 (currently only 16.4)


Is there any way to force Dash to use a newer version of React? Or is there any time-line as to update Dash to run with 18.2?

Any insights would be helpful.

The main reason I’m asking is that e.g. Aggrid seems to have worse render performance for large tables under 16.4 versus 18.2.

As a test I created a component (through cookiecutter) and updated the react version.

When running it through the react testing server (using 18.2) I can scroll very smoothly.
When running it through the react testing server (using 16.4) then scrolling is clearly lagging. I can see the cells being drawn.
When running it through Dash as a component (Dash forces 16.4) then scrolling is again lagging.

I understand that this is a non-Dash library specific problem, however I can imagine that updating to a more recent React version (or indicating how it could be hacked) is something that has come up?

No firm timeline, but it’s rising quickly on our priority list. The process will be something like:

  • Add v18 as an experimental option, likely dash._dash_renderer._set_react_version("18.2.0")
  • See if anything breaks in the Dash core, and fix it. Add a flavor of all the dash/dcc/table tests using v18
  • Alert maintainers of 3rd-party component packages to the v18 option and encourage them to try it and make any necessary adjustments
  • Do the same with all the other (non-core) Plotly-maintained component packages
  • Once we have sufficient confidence the component ecosystem can handle it, we’ll make v18 the default, but keep v16 around for a while as a backup for anyone who still needs a component (or version of a component) that can’t use v18

Okay thanks.

Is there a way to already force Dash to use the newest React without touching the source code (I assume the above “dash._dash_renderer._set_react_version(“18.2.0”)” is how it could be, but that’s not available right now)? Or some pointers as to which sections need to be hacked?

Right, this is not available right now, would need to be added. Thanks for creating Use React version 18.2 · Issue #2254 · plotly/dash · GitHub - let’s continue this discussion there.