Developer/React.js 썸네일형 리스트형 [Tutorial] State ■ HTML / JSP JS Bin ■ JS(ES6/Babel) class Counter extends React.Component{ constructor(props) { super(props); this.state= { value: 0 }; this.handleClick = this.handleClick.bind(this); } handleClick() { this.setState({ value: this.state.value+1 }); } render() { return ( {this.state.value} Press Me ); } } class App extends React.Component { render() { return ( ); } } ReactDOM.render( I am React.js.. 더보기 [Tutorial] Props ■ HTML/JSP JS Bin ■ JS (ES6/Babel) class Codelab extends React.Component{ render() { return ( Hello {this.props.name} {this.props.number} {this.props.children} ); } } Codelab.propTypes = { name: React.PropTypes.string, number: React.PropTypes.number.isRequired }; Codelab.defaultProps = { name: 'Unknown', number: 5 }; class App extends React.Component { render() { return ( {this.props.children} ).. 더보기 [Tutorial] JSX ■ HTML / JSP ■ JS(ES6 / Babel)class Codelab extends React.Component{ render() { let text = 'Hello React.js'; let style= { backgroundColor:'aqua' }; return ( {text} ); }} class App extends React.Component { render() { return ( ); }} ReactDOM.render(, document.getElementById('root')); 더보기 이전 1 다음