sharetribe / web-template

Sharetribe Web Template - starting point to create a client app to your marketplace
Other
28 stars 125 forks source link

[Question] Update to React 18 #425

Open wjamro opened 1 month ago

wjamro commented 1 month ago

First of all, thank you for the awesome work you do. Jumping straight to the point: Do you plan to update the web-template to React 18 anytime soon?

Gnito commented 1 month ago

@wjamro Yes, we are planning to update to React v18.

The challenge is that there has been at least 2 libraries that are prohibiting this: React Dates and Enzyme. We kicked Enzyme out earlier, but react-dates (a date-picking library) needs more work before it can be removed.

We have an ongoing project to create new date-picking component and start using it on different places where react-dates is in use. On top of that, there might be some other work needed before React 18 can be supported. At least, hydration logic has changed on v18, which might mean that there can be hydration issues that needs to be addressed. However, before we continue with this work, there are some permission-related projects that need to be completed first.

Background story: Both libraries were originally created by AirBnB, but they transferred the ownership to some solo OS dev, when they changed their frontend stack few years back.

React Dates has its internal tests written with Enzyme testing library. The Enzyme testing library needs adaptors to work with any given version of React. IIRC, the reason, why Enzyme does not support newer React versions, was that React team hasn't released docs on how to hook on those version specific virtual-dom fragments that the Enzyme needs. I'm not sure if that's the whole story.

As a summary, Enzyme is not updated - and React Dates is not updated, because its internal enzyme-based tests are not updated.