# 리액트 튜토리얼
## 0. 참고하면 좋을 사이트
## 1. state
let account = 0x000ads0affads;
<h1>{account}</h1>
account=1faadsfadsfadsf
- 데이터가 저장되는 곳, 변할때 마다 자동 렌더링
```js
const [counter, setCounter] = useState(0); // number
const [loading, setLoading] = useState(true); // boolean
const [weather, setWeather] = useState([]); // list
const onClick = () => {
setCounter((current) => current + 1);
};
```
## 2. props
- 부모 컴포넌트로 부터 자식 컴포넌트에 state를 보낼 수 있게 하는 방법
```js
<Props weather={weather} count={counter} />
```
'React' 카테고리의 다른 글
[React] useEffect (0) | 2023.06.12 |
---|---|
[React] 에러 해결 : img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text (0) | 2023.06.06 |
[React] React.JS, React-dom , Babel, JSX (1) | 2023.06.05 |
[React] 오류 sh: react-scripts: command not found (0) | 2023.06.04 |
[React]react-router-dom 설치하기 (0) | 2023.06.03 |