React Hook이란?

요즘 핫하다는 리액트 훅에 대해서 조사해봤다.



리액트 훅은 리액트 16.8에 도입된 추가적인 기능이다.

리액트 훅을 아주 간단하게 설명하자면, class를 쓰지 않고, function에서 state 를 운용할 수 있는 기능이다.

import React, { useState } from 'react';

function Example() {
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
);
// Declare a new state variable, which we'll call "count"
const [count, setCount] = useState(0);
}

이런식으로 말이다.

https://reactjs.org/docs/hooks-intro.html