Created
September 21, 2017 11:17
-
-
Save lazyTai/cc0b25dd42129fc9d3c2aba437137e79 to your computer and use it in GitHub Desktop.
initial react state
in easy way no construct
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * | |
| 刘明泰 | |
| 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
state = {
a: 1, b: 2
}