2 ms·
import React from 'react'; import ReactDOM from 'react-dom'; function App(props) { return <div>Hello {props.name}</div>; } ReactDOM.render( <App name="nic
by brentvatne 10y ago
import React from 'react';
import ReactDOM from 'react-dom';
function App(props) {
return <div>Hello {props.name}</div>;
}
ReactDOM.render(
<App name="nichochar" />,
document.getElementById('root')
);
Or the alternative component API that has componentWillMount, componentDidMount, componentWillReceiveProps, shouldComponentUpdate, componentDidUpdate, componentWillUnmount, and render.
That's pretty much all there is
- alexbecker 10y agoI believe they are complaining about the ~150kb minified filesize, rather than the API surface area.
- barryhoodlum 10y agoIt's under 40kb gzipped. If that's a sizeable percentage of your total JS code, you probably didn't need React in the first place.
- grumblestumble 10y agoIf that's pretty much all there is, you'd be better off saving ~150kb and just using ES6 template strings.