4 ms·
As said above, we have used the Todo mvc React example as is. There are still a lot of projects who are using the "obsolete". Given a Todo mvc functional compo
by yoava 6y ago
As said above, we have used the Todo mvc React example as is. There are still a lot of projects who are using the "obsolete".
Given a Todo mvc functional component example, will try to use the stencil functional component syntax to build an equivalent
- PKop 6y ago>There are still a lot of projects who are using the "obsolete" What relevance is this though? There's always going to be legacy code somewhere, but you made the comparison article in 2020, not years ago. There's new established patterns, quoting out of date examples thus provides little value to your reader. Also your other comment suggests your intention was guidance on greenfield projects, in which case 4 years old syntax makes 0 sense.
- yoava 6y agoI am confused. In the react docs - here specifically, https://reactjs.org/docs/state-and-lifecycle.html https://reactjs.org/docs/state-and-lifecycle.html The first action item when talking about state is to concert a function to a class. Are you saying that the official react docs, when introducing state, promote using an obsolete API?
- PKop 6y agoYes. "We recommend trying Hooks in new code" [0] "..we’d encourage you to start trying Hooks in new components you write" "In the longer term, we expect Hooks to be the primary way people write React components." You made a conscious choice to use code with "var" and class components in a side-by-side comparison of an article titled "IS Stencil Better than React" which implies right now, not "is this old example of TodoMVC better than Stencil's example". My overarching point is this choice was a bad choice, if your purpose was to inform. [0] https://reactjs.org/docs/hooks-faq.html https://reactjs.org/docs/hooks-faq.html
- yoava 6y agoConsidering that hooks are recommended in the hooks-faq, yet the React 1,2,3 Main Concepts talks OO - I find the statement that OO is obsolete. Maybe that is the intention of the React team, but it is not reflected in their main documentation yet. As for the style of the React example - I have taken the React example from todoMVC "as is". I invite you to write any other React implementation of TodoMVC, and will do my best to create the equivalent with Stencil.