Skip to content

Instantly share code, notes, and snippets.

@lazyTai
Created September 21, 2017 11:17
Show Gist options
  • Select an option

  • Save lazyTai/cc0b25dd42129fc9d3c2aba437137e79 to your computer and use it in GitHub Desktop.

Select an option

Save lazyTai/cc0b25dd42129fc9d3c2aba437137e79 to your computer and use it in GitHub Desktop.
initial react state in easy way no construct
/*
*
刘明泰
mail:[email protected]
github:lazyTai
*/
import React, {Component} from 'react';
class BooksList extends Component {
state = {
a: 1, b: 2
}
render() {
let {a, b} = this.state;
console.log(a)
console.log(b)
return <div style={{backgroundColor: "#eee"}}>
<button>left</button>
</div>
}
}
export default BooksList
@lazyTai
Copy link
Author

lazyTai commented Sep 21, 2017

state = {
a: 1, b: 2
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment