preactjs / preact-compat

ATTENTION: The React compatibility layer for Preact has moved to the main preact repo.

Home Page:http://npm.im/preact-compat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Beyond (P)react 16

RoyalIcing opened this issue · comments

With the upcoming changes in a future version of React, I was wondering at this early stage what direction Preact will likely take?

Is Preact likely to to adopt these new ‘time slicing’ and ‘suspense’ capabilities, in whatever form they will eventually come? Or is there value in keeping to a simpler API?

P.S. I couldn’t find mention of this yet, so let me know if there is already an issue on this somewhere.

This has been an ongoing discussion amongst the various people who contribute to Preact. Obviously a good chunk of the value of Preact (at least for those using preact-compat) is that it's syntactically the same as React. It seems like we'll have to support the much more nuanced behavior of React 16+ in some form, whether that is through -compat or by changing Preact itself remains to be seen.

There has been some work going on to adopt a few of the newer APIs (getDerivedStateFromProps(), componentDidCatch(), etc) - these are things that are independently useful and don't rely on React's internal rendering details.

The "suspense" stuff seems like it will be somewhat of a freebie once we have patched in support for componentDidCatch in Preact's core.

"Time slicing" I assume refers to React's async rendering. We've been been investigating async rendering for a year or two - there's some decent movement on that front in various places, but personally I've been pulled away for a bit and haven't had time to move it forward much.

With Preact X we ship an early preview of Suspense. It's not production ready yet. Time slicing is something we'll likely not adopt. It sounds cool on paper, but the benefits are a lot less visible in the real world. On top of that it's a very complex concept to implement which makes us even more skeptical given the little benefit we'd get from it.