-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC]: Upgrading to React 18 for Redwood #5881
Comments
For those who want to install react-three/fiber use this and for Three.js on redwood |
Thanks @Gresliebear! @virtuoushub has tried to upgrade to React 18 on and off here: #4992. Originally, we had to wait for many other packages we use to use upgrade, but I'm not so sure we're waiting on too many other packages anymore. Maybe just storybook v7. But even then, v6.5.9 may still work with react 18, it's just not written in it. If Redwood core could support it (i.e., the router, the web side—running I haven't tried in depth yet, but here's some an incomplete list of some of the things we may have to do to upgrade to React 18...
Note that once we upgrade, we'd probably need to give the router a hard look. But again, I'm not sure that it's a hard requirement, just something we should do. If you wanted to take a next step here, I'd try @virtuoushub's PR locally and see what happens. |
@jtoar :
These should be taken care of in #4992 :
Using these failing unit tests as a metric, something seems weird w/ auth providers: although this may have more to do with the tests themselves rather than anything with auth providers ( there is a comment in each of the failing tests
not sure, haven't really tested this part yet.
I believe Storybook 6.5+ does work with React 18 ( https://github.com/storybookjs/storybook/pull/17215/files )
fwiw, I have installed React 18 in our example-storybook repo here https://github.com/redwoodjs/example-storybook/blob/main/web/package.json#L21-L22 and found no errors other that than a warning in the console:
which I'd expect due to Redwood's current lack of React 18 support. |
should follow through on all these steps @jtoar mention or install React 18 and follow the latest from @virtuoushub I was gonna install React 18 run through the tutorial completely from the docs and document as I went. |
Oh see yes auth providers and then types and then yarn rw prerender gotcha! i will get to it after work |
@thedavidprice I recall that you had some info on upgrading to React 18 after coming back from Prisma Day? |
@Gresliebear from what @virtuoushub said, it sounds like the tutorial would work, but confirming that does indeed would certainly be valuable! And trying out a few auth providers and prerender especially too would get us closer to 100% coverage. But no pressure of course! Either way, I'll queue up React 18 for discussion cause it sounds like we could let people opt into it a lot sooner than I thought. |
tutorial React 18 errrors cd into E:\RedwoodWindows\redwood\packages\web framework uninstalled react and react-dom in the web packages.json my test project when I
now in my test project when I run Nevermind forgot to yarn install after my syncing, still that did not fix it ➤ YN0000: Done with warnings in 5s 414ms $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] ... Apparently 'yarn run dev' doesnt work anymore use 'yarn redwood dev' the syncing doesn't make sense on docs, does this change test project/src/web package.json? Even though in my framework I installed react-18 on the framework the sync does change anything Trying to yarn build with React 18 Frameworkcd into the framework and try running 'yarn build:test-project'
Now trying a Test Project uninstall react 17 and install react 18 without framework changesin the redwoodblog or redwoodproject we use for as test project for our changes we uninstalled react-17 and react-dom 17 Then we 'yarn add react' 'yarn add react-dom' we can see package.json in web is changed
Redwood tutorial with React-18 only change directly on redwoodblog/src/web
worked without issue
Installed without issue
we ran, which generated our page and it loads
however the "yarn rw-gen-watch" exited with code 134 I don't know what that means.
The HomePage.js, HomePage.test.js, HomePage.stories.js, and Routes Generated correctly Checking consoleSo now this basically means that the React.Render is within Node_modules instead of any actually directory so yes we need sync to be connected. Need better test code, hard to tell is the sync is working correctly? from the docs https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#updates-to-client-rendering-apis So if look at index.js for Redwood and change it to createRoot the change is not so simple because if we have rootElements and pass it to hydrateRoot its been separated out and we need to update the root render again after the addition. reactwg/react-18#5
it worked we don't have React 18 warning but we duplicated the React root render we made some code changes to index.js
However were still stuck with a Warning
and duplication How to use rootHydrate, originally I was using rootCreate and rootHydrate incorrectly. this code below solves it and stops duplication
Changes to latest @testing-library/react
|
@virtuoushub it will take me a little bit to catch up to these changes on my end I just got createRoot and rootHydrate working https://github.com/redwoodjs/redwood/pull/4992/commits |
Continuing Tutorial
works Chapter 1 works in general with React 18 updates and CreateRoot |
A quick comment to observation made by @Gresliebear above I made the same mistake too many times: the command P.S. I visited this issue because of the @virtuoushub's remark "kudos to @Gresliebear for all work done on testing" - so I am joining Peter. |
#43 is about done, at which point I think we should probably close this ticket out too. |
Summary
I want to use the latest package for React 18, because packages on npm install used React 18 but currently Redwood doesn't
Motivation
I want to use the latest version of three.js
I want to use the latest version of react-three-fiber
Detailed proposal
Proposal I install React 18 and try running it on Redwood and make detail errors in this thread.
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: