hooks1 [React] Hooks : 클래스 컴포넌트에서 함수형 컴포넌트로 리액트팀에서 React Hook을 발표했는데 함수형 컴포넌트에서도 이제 state와 side-effect를 적용 가능하게 되었습니다. 기본적으로 제공하는 Hook부터 커스텀 Hook까지 살펴보도록 하겠습니다. `useState` Hook : 컴포넌트의 state관리 class App extends React.Component { constructor(props) { super(props); this.state = { value: '', }; } onChange = event => { this.setState({ value: event.target.value }); }; render() { return ( Hello React ES6 Class Component! {this.state.value} ); }.. 2019. 7. 25. 이전 1 다음