8. 8 / 34
Basic Examples
One HTML
basic
basic-jsx
basic-jsx-harmony
basic-click-counter (state)
ber (react-dom- ber)
One HTML + One JS
basic-jsx-external (src/example.js)
basic-jsx-precompile (build/example.js)
HTML+JS+package.json (npm)
basic-commonjs (bundle.js)
16. 16 / 34
<scriptsrc="../../build/react-dom-fiber.js"></script>
<script>
functionExampleApplication(props){
varelapsed=Math.round(props.elapsed /100);
varseconds=elapsed/10+(elapsed%10?'':'.0');
varmessage=
'Reacthasbeensuccessfullyrunningfor'+seconds+'seconds.';
returnReact.DOM.p(null,message);
}
//CallReact.createFactoryinsteadofdirectlycallExampleApplication({...})inReact.render
varExampleApplicationFactory=React.createFactory(ExampleApplication);
varstart=newDate().getTime();
setInterval(function(){
ReactDOMFiber.render(
ExampleApplicationFactory({elapsed:newDate().getTime()-start}),
document.getElementById('container')
);
},50);
</script>
fiber
basic with ber
function vs. React.createClass()
ReactDOMFiber vs. ReactDOM
Ref: React Fiber is an ongoing
reimplementation of React's core
algorithm. It is the culmination of over
two years of research by the React team.
[ React Fiber ]
33. Refs
1. A JavaScript library for building user interfaces | React
2. facebook/react: A declarative, e cient, and exible JavaScript library for building user
interfaces.
3. acdlite/react- ber-architecture: A description of React's new core algorithm, React Fiber
4. Intro and Concept - Learning React
33 / 34
34. 34 / 34
END
Eueung Mulyana
https://eueung.github.io/112016/react-cont
CodeLabs | Attribution-ShareAlike CC BY-SA