-
Notifications
You must be signed in to change notification settings - Fork 4
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
Switch to React 16 #263
Switch to React 16 #263
Conversation
Currently has to be tested using `NO_TYPE_CHECK=1 yarn dev`
I ran some benchmarks against a local production build, and to eliminate network variations, the app was built against a local API instance as well: React 16:
Preact:
|
I'm not sure how to interpret the first image that shows the sizes. I guess it shows the relative difference? React doesn't seem that bad, except React DOM is pretty big 😄 As for the performance, the two are comparable from what I can tell with React having somewhat of an edge. |
Yeah, this shows the relative module sizes using Webpack Bundle Analyzer (
The benchmarks above test the performance of SSR. It seems that React and Preact are comparable in performance and the difference is negligible. |
It turns out that the TypeScript issues were due to multiple, incompatible versions of
Removing all of these (except This is why Luckily, "resolutions": {
"@types/react": "^16.0.35"
}, ... and now everything works! |
One thing I noticed is that Preact is much more permissive regarding SSR vs client markup mismatch issues. It tries to fix the mismatches and does so silently. React on the other hand throws an error and does not fix it and the page ends up broken. |
Interesting. Perhaps the libraries follow different philosophies with regard to failing loud vs failing silently? I wonder if React offers the option to be more tolerant of that issue. Though, if the React engineers think this is a significant issue that should be fixed instead of suppressed, they probably wouldn't offer the option to silence it. |
This is relevant: facebook/react#10591
|
This one too: facebook/react#11064
|
…to switch-to-react-16
Oops! Please dismiss the review request. This still need some work. Because React does not like SSR/client mismatches, we have to come up with a reproducible random string for the collapsable ID. We'll need to use React Context API for this. |
Using the current context API with TypeScript proved to be a little tricky. I ended up moving the responsibility of defining the collapsable ID to the consuming component. Hopefully, a new React version, with the new context API, gets released soon so that we can move back to auto-generated IDs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
Currently has to be tested using
NO_TYPE_CHECK=1 yarn dev