React Cookbook by Carlos Santana Roldan

React Cookbook by Carlos Santana Roldan

Author:Carlos Santana Roldan
Language: eng
Format: epub
Tags: COM051260 - COMPUTERS / Programming Languages / JavaScript, COM060180 - COMPUTERS / Web / Web Services and APIs, COM060160 - COMPUTERS / Web / Web Programming
Publisher: Packt Publishing
Published: 2018-08-30T10:09:47+00:00


How to do it...

We are going to make a Todo list with some animations:

First, let's create our Todo component:

import React, { Component } from 'react';

import uuidv4 from 'uuid/v4';

import List from './List';

import './Todo.css';

class Todo extends Component {

constructor() {

super();

// Initial state...

this.state = {

task: '',

items: []

};

}

componentWillMount() {

// Setting default tasks...

this.setState({

items: [

{

id: uuidv4(),

task: 'Default Task 1',

completed: false

},

{

id: uuidv4(),

task: 'Default Task 2',

completed: true

},

{

id: uuidv4(),

task: 'Default Task 3',

completed: false

}

]

});

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.