You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 functions render + hydrate, which replace a DOM node with one generated by React.createElement
What if instead of replacing an entire node, you could simply inject JavaScript into it?
<inputid="search-bar"
type="text"
placeholder="Search for stories... with React Hooks!"
value=""><ulid="search-results"><!-- using real data, the server-side could display data here --></ul>
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
The text was updated successfully, but these errors were encountered: