Closed English3000 closed 3 years ago
@sophiebits, WDYT?
a la morphdom but with a cleaner React API.
Hi, thanks for your suggestion. RFCs should be submitted as pull requests, not issues. I will close this issue but feel free to resubmit in the PR format.
A colleague at work recently turned me onto Vue. So I read "The Majesty of Vue 2".
In it, there is a project where you use Vue for a search bar and results.
After learning Vue, I looked to see if React had any functionality like it. The closest I could find is React Hooks.
Below are pictures of a search bar with results (and their respective code bases) rendered with React and with Vue.
In a nutshell, the one use case where Vue beats React is SSR because in order to make that work in React, one needs to setup a Node server.
What I am proposing is a Vue-inspired work around.
react-dom
already provides the functionsrender
+hydrate
, which replace a DOM node with one generated byReact.createElement
What if instead of replacing an entire node, you could simply inject JavaScript into it?
So, for example, instead of:
and
I could do
In this way, I no longer have to duplicate an
<input>
and include an extra<div>
to get SSR.cc: @gaearon