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

Lightning Talk - Vue/React

djirdehh
November 02, 2017

Lightning Talk - Vue/React

A 5min lightning talk covering the similarities/differences between two amazing JS libraries (Vue/React)

djirdehh

November 02, 2017
Tweet

More Decks by djirdehh

Other Decks in Technology

Transcript

  1. “What if I could just extract the part that I

    really liked about Angular and build something really lightweight without all the extra concepts involved?” -
  2. Virtual DOM Component Based Methodology Props Build Environments vue-cli create-react-app

    Browser Devtools Router vue-router react-router Flux vuex redux Two-way data binding
  3. class MessageComponent extends Component { state { message: "" }

    handleMessageChange = (e) => { this.setState({ message: e.target.value }) } render() { return ( <div> <input type=“text” onChange={this.handleMessageChange}/> <span>{this.state.message}</span> </div> ); } }
  4. var Message = new Vue({ el: ’#message’, data: { message:

    ’’ } }); <div id=“message”> <input type=“text” v-model=“message”/> <span>{{ message }}</span> </div>
  5. class MessageComponent extends Component { state { message: "" }

    handleMessageChange = (e) => { this.setState({ message: e.target.value }) } render() { return ( <div> <input type=“text” onChange={this.handleMessageChange}/> <span>{this.state.message}</span> </div> ); } } var Message = new Vue({ el: ’#message’, data: { message: ’’ } }); <div> <input type=“text” v-model=“message”/> <span>{{ message }}</span> </div>
  6. var Message = new Vue({ el: ’#message’, data: { message:

    ’’ }, created() {}, mounted() {}, computed: {}, methods: {} });
  7. Templates! <input type=“text” v-model=“message” /> <h1 v-if=“thisBooleanIsTrue”></h1> <li v-for=“item in

    items”> {{ item.message }} </li> <li v-bind:class=“{ active: booleanTrue } ”> {{ item.message }} </li>
  8. Reactive State! “State” often relates to the data object in

    the Vue instance/components No need to call setState() - Data object is automatically reactive to the view