Given a Todo mvc functional component example, will try to use the stencil functional component syntax to build an equivalent
Given a Todo mvc functional component example, will try to use the stencil functional component syntax to build an equivalent
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.
In the react docs - here specifically, 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?
"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.
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.