Router === npm i react-router-dom
Cookie === npm i universal-cookie
Axios === npm i axios
react-native-rsa === npm i react-native-rsa
정의 | 스코프 | 변수 재정의 | 호이스팅 시 에러 |
---|---|---|---|
var | 함수 스코프 | 변수 재정의 가능 | 미발생 |
let | 블록 스코프 | 변수 재정의 가능 | 발생 |
const | 블록 스코프 | 변수 재정의 불가 | 발생 |
화살표 표기법(arrow notation)은 function이라는 단어와 중괄호 숫자를 줄이려고 고안된 단축 문법이다.
ex1) function 생략
const f1 = function() {return "hello!";}
const f1 = () => "hello!";;
ex2) 매개변수 괄호 생략
const f2 = function(name) {return 'Hello, ${name}!';}
const f2 = name => 'Hello, ${name}!';
React 에서 자주 사용하는 Javascript 문법 정리
Reacrt version 18
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
React version 17
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
const headers = {'Content-Type': 'text/plain'};
[개념 정리] http content-type 관한 정리
useRef는 리렌더링 하지 않는다. 컴포넌트의 속성만 조회&수정한다.
공식문서
💡 리액트 컴포넌트가 될 때마다 특정 작업을 실행할 수 있도록 하는 Hook
💡 RSA 키 생성 및 암호화/복호화, 서명/검증의 기본 구현