Upgrade to Pro — share decks privately, control downloads, hide ads and more …

React.js: le nouveau truc cool

JP Boily
April 28, 2015

React.js: le nouveau truc cool

Petit survol de React et son écosystème. Très très haut niveau. Donné dans le cadre de http://saglac.io/ en Avril 2015.

JP Boily

April 28, 2015
Tweet

More Decks by JP Boily

Other Decks in Technology

Transcript

  1. Rainforest QA rainforestqa.com Human-powered cross-browser integration test, in plain English.

    Fast! Very very fast! Days of testing in minutes. Backed by @ycombinator + @heavybit
  2. Exemple var HelloMessage = React.createClass({ render: function() { return <div>Hello

    {this.props.name}</div>; } }); React.render(<HelloMessage name="John" />, mountNode);
  3. JSX! var HelloMessage = React.createClass({ render: function() { return <div>Hello

    {this.props.name}</div>; } }); React.render(<HelloMessage name="John" />, mountNode);
  4. Compiled JS var HelloMessage = React.createClass({displayName: "HelloMessage", render: function() {

    return React.createElement("div", null, "Hello ", this.props.name); } }); React.render(React.createElement(HelloMessage, {name: "John"}), mountNode);
  5. State & mount var Timer = React.createClass({ getInitialState: function() {

    return {secondsElapsed: 0}; }, tick: function() { this.setState({secondsElapsed: this.state.secondsElapsed + 1}); }, componentDidMount: function() { this.interval = setInterval(this.tick, 1000); }, componentWillUnmount: function() { clearInterval(this.interval); }, render: function() { return ( <div>Seconds Elapsed: {this.state.secondsElapsed}</div> ); } }); React.render(<Timer />, mountNode);
  6. RefluxJS! https://github.com/spoike/refluxjs ╔═════════╗ ╔════════╗ ╔═════════════════╗ ║ Actions ║──────>║ Stores ║──────>║

    View Components ║ ╚═════════╝ ╚════════╝ ╚═════════════════╝ ^ │ └─────────────────────────── ────┘ uni-directional dataflow