Dojo ReactJS

André Filipe Goulart, Desenvolvedor Front-end Submarino.

React JS

by André Filipe Goulart

Vamos começar?

Uma biblioteca e
não um framework.

Single Page Applications

Facebook, Instagram,
Empresas e Devs
pelos mundo

Elementos React

Virtual DOM
(pseudo-DOM)

Componentes

Componente - Slide

Componente - SlideItem

Componente - SlideElements

JSX

JSX

        <h1>Oi</h1>
      React.createElement('h1', null, 'Oi');
      React.createClass({  render: function(){    return (<h1>Oi</h1>)  }});

Anatomia de uma aplicação React

anatomia

Anatomia de uma aplicação React

thinking in react mock

Renderização

        React.render(  <h1>Hello World</h1>, document.body);

Javascript Reativo

Componente

Componente

        var Todo = React.createClass({  render: function() {    return (      <ul>        <li>item 1</li>      </ul>    )  }});React.render(<Todo />, document.body);

Props

Props

        var Todo = React.createClass({  render: function() {    return (      <ul>        <li>{this.props.title} </li>      </ul>    )  }});React.render(<Todo title="My figure 1" />, document.body);

State

State

        var Todo = React.createClass({  getInicialState: function() {    return {      done: false    }  },  render: function() {    return (      <ul>        <li>          <input type="checkbox" checked={this.state.done}> {this.props.title}        </li>      </ul>    )  }});React.render(<Todo title="My figure 1" />, document.body);

Javascript Isomorfico
(Javascript Universal)

Data-biding

Data-biding

      var NoLink = React.createClass({  getInitialState: function() {    return {message: 'Hello!'};  },  handleChange: function(event) {    this.setState({message: event.target.value});  },  render: function() {    var message = this.state.message;    return (      <div>        <input type="text" value={message} onChange={this.handleChange} />;        <h2>{message}</h2>;      </div>    )  }});

Why React?

  1. Não é um framework MVC.

Referências

  • http://facebook.github.io/react/blog/2013/06/05/why-react.html
  • http://facebook.github.io/react
  • Raphael Amorim - Meet React (Criando aplicações web com ReactJS)
  • http://tableless.com.br/react-javascript-reativo/
  • http://willianjusten.com.br/comecando-com-react/
  • http://www.hugobessa.com.br/posts/comecando-com-react/
  • Referências

    </thanks>

    A apresentação está no GitHub

    twitter: @afgoulart

    afgoulart.rj@gmail.com

    http://github.com/afgoulart - Github