3 ms·
For most problems, the following is how you define a component: function Comp(state) { return React.createElement( 'div', // tag name
by pluma 11y ago
For most problems, the following is how you define a component:
function Comp(state) {
return React.createElement(
'div', // tag name
{}, // props/attributes
'Hello ', state.name // children
);
}
And this is how you use it:
ReactDOM.render(
React.createElement(Comp, {name: 'World'}),
document.getElementById('stage')
);
So in those situations the entire surface of the React API consists of two functions: React.createElement and ReactDOM.render. And if you use JSX, you won't even directly use React.createElement in your code.
React is conceptually trivial. The API has been getting tighter with each release. React is in active development but so are all of its competitors[1][2]. React is production ready -- Facebook is even dogfooding the pre-releases in production.
[1]: in fact, when a library/frameworks stops being actively developed people start assuming it's dead. Counter-example: Redux is no longer actively being developed because it is officially complete and the implementation is so straightforward and resilient it can't really be improved right now.
[2]: the reason it's bogus to compare it to Angular2 "because that's not finished yet either" is that Angular2 is being built to spec whereas React is being developed under use. Angular2 will be "finished" when the full spec is implemented. React will be "finished" when real-world use shows no further need to change -- by that definition none of the alternatives (including Angular2 post-"final") is "finished" either.