์ค๋์ ํ์คํ : react๋ ์ ๋ง ํจ์จ์ ์ด์ง๋ง ๋์์ ์ด๋ ค์ด ์น๊ตฌ๋ก๊ตฌ๋.
์ผ๋จ ์ค๋์ ๊ฐ๋ณ๊ฒ react์ PropTypes์ ๋ํด์ ๋ฐฐ์ ๋๋ฐ ์ดํด.. ์ ๋ง ์ด๋ ต๋ค ์ด๋ ค์!
PropTypes์ css๋ ํจ์๋ฅผ ๋ชจ๋ํ๋ฅผ ์์ผ์ ๊ฐํธํ๊ฒ ์ฌ์ฉํ๊ฒ ํด์ค๋ค๋ ๊ฐ๋
์ธ ๊ฒ ๊ฐ์๋ฐ
์์งํ ๋ด๊ฐ ๊ฐ๋
์ด ์ ์์กํ๋ฉด ์๊ฐ์ฐ๋ฉด์ ๋ค์ ๊ฐ์ ๋ฃ์ง๋ง๊ณ ๋ค๋ฆ ์ฌ๋๋ค์ด ๋จ๊ธด ๊ธ์ ๋ณด๋ฉด์ ๊ฐ๋
์ ๋ฆฌํ๋๊ฒ ์งฑ์ด๋ค.
์ผ๋จ ์ค๋ ํ ์์ ๋ค์ ์ดํด๋ณด์!
์ด๋ฐ์์ผ๋ก ์ฌ๋ฌ๊ฐ์ง ๋ชจ๋์ ๋ง๋ค์ด์
import Button from "./Button";
import styles from "./App.module.css";
function App() { // ํจ์์ปดํฌ๋ํธ
return (
<div>
<h1 className={styles.title}>Welcome back!</h1>
<Button text={"continue"}/>
<Button text={"hola"}/>
</div>
);
}
export default App;
์ด๋ฐ์์ผ๋ก importํด์ฃผ๋ ๊ฒ์ด๋ค!
์ด๋ ๊ฒ import๋ฅผ ํ๋ฉด ๋จ์ css์๋ ์์ด๋ค์ด ๊ฐ์ฒด๊ฐ ๋์ด์ ์ด๋์๋ ๋ถ๋ฌ์ ์ฌ์ฉํ ์ ์๋ ์ฅ์ ์ด ์๋ค!
์ด๋ ๊ฒ ์ฌ์ฉํ๋ฉด ์ฌ์ฉํ๋ ํด๋์ค์ ์ด๋ฆ์ ๊ฐ์ง๊ณ ์์ css๋ฅผ ์์ฑํ๋๊ฒ ์๋๊ธฐ๋๋ฌธ์ css๋ฅผ ์ฌ์ฉํ๋๊ฒ ํจ์ฌ ํธ์ํ๋ค!
๊ทธ๋์ PropTypes๋ ์ด๋ค ์น๊ตฌ์ผ๊น..?
์ฐพ์๋ณด๋ React์์ ์ปดํฌ๋ํธ์ ์์ฑ(prop) ์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ ์ํ ๋๊ตฌ ๋ผ๊ณ ํ๋ค์...
์๋ฌดํผ ๊ทธ๋๋ ์ฅ๋จ์ ๋ ๊ถ๊ธํ๋๊น ์ฐพ์๋ด
๋๋ค!
์ด๋ฌํ ์ฅ๋จ์ ์ ๊ฐ์ง๊ณ ์๋ค๊ณ ํ๋๋ฐ์! ๋น๋ ์ ์ ๊ฑฐํด์ผํ๋ค๋ ์ด์ ๊ฐ ์ ๋ง ๊ถ๊ธํด์ ์ ๋ ๊ผญ ์ ์์ผ๋ก ํ
์คํธ ํด๋ณด๊ฒ ์๋ค..
์๋ฌดํผ๊ฐ์ ์ด๋ ๊ฒ ์์
๋ด์ฉ ์ ๋ฆฌ๋ ๋ง์น๊ฒ ๊ณ ...
๋ณ๋๋ก.. ์ ๋ง ๊ฐ๋ฐ์์ ์ ์ผ ์ด๋ ค์ด ๊ฐ๋ฐํ๊ฒฝ ์ ํ ..
๋ถ๋ช ์ด์ ๊น์ง ์๋๋ react๊ฐ
> react-for-beginners@0.1.0 start
> react-scripts start
'react-scripts'์(๋) ๋ด๋ถ ๋๋ ์ธ๋ถ ๋ช
๋ น, ์คํํ ์ ์๋ ํ๋ก๊ทธ๋จ, ๋๋
๋ฐฐ์น ํ์ผ์ด ์๋๋๋ค.
์ด๋ฌ๋ฉด์ ์ ์์ ์ผ๋ก ์๋๋์ง ์๋๊ฒ ์๋๊ฒ ์ด์..
๊ฒ์ํด๋ณด๋ react-script๊ฐ ์ ์ ์ค์น๋์ง ์์๋ค๋...
๋ถ๋ช
์ด์ ํ๋๋ฐ... ๋ญ์ง..
ํ๋ฉด์ ์ผ๋จ..
npm install react-scripts ์คํํฉ๋๋ค.
์ ์ค์น๋๋ค๊ฐ..
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated prop-type@0.0.1: this package is no longer maintained and propably broken
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
added 1486 packages, and audited 1487 packages in 35s
234 packages are looking for funding
run npm fund for details
6 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit for details.
์ด๋ฐ ์ค๋ฅ๊ฐ...
ํ ๋ ์ฐ๋,,,
์๋ฌดํผ ๋ ์ด์ฌํ ์ฐพ์๋ด ๋๋ค..
๋ฐ์ ๊ฒฝ๊ณ ๋ฉ์์ง๋ ํน์ ํจํค์ง๋ค์ด ๋ ์ด์ ์ง์๋์ง ์๊ฑฐ๋ ๋ณด์ ์ทจ์ฝ์ ์ด ๋ฐ๊ฒฌ๋์๋ค๋ ๊ฒ์ ์๋ฆฌ๋ ๊ฒ์ ๋๋ค. ์ด๋ฌํ ๊ฒฝ๊ณ ๋ฉ์์ง๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ค์ ๋ ๊ฐ์ง ๋จ๊ณ๋ฅผ ์งํํ ์ ์์ต๋๋ค.
1.๋ณด์ ์ทจ์ฝ์ ์ด ์๋ ํจํค์ง๋ค์ ์
๋ฐ์ดํธํ์ญ์์ค. ํฐ๋ฏธ๋์์ ์๋ ๋ช
๋ น๋ฅผ ์คํํด ๋ณด์ธ์. ์ด ๋ช
๋ น์ ํจํค์ง ๋ฒ์ ์
๋ฐ์ดํธ์ ํจ๊ป ์ผ๋ถ ํจํค์ง์ ํ๊ฒฝ ์ค์ ๋ฐฉ์ ๋ณ๊ฒฝ์ด ์์ ์ ์์ผ๋ฉฐ, ์ด ๊ฒฝ์ฐ ์๋์ผ๋ก ๋ณ๊ฒฝํด์ผ ํ ์๋ ์์ต๋๋ค.
npm audit fix
2.๊ฐ์ ๋ก ๋ชจ๋ ํจํค์ง ์
๋ฐ์ดํธํ๊ธฐ ์ํด์ --force ์ต์
์ ์ฌ์ฉํ ์ ์์ง๋ง, ์ด๋ ๊ฒ ํ๋ฉด ๋นํธํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ผ๋ ์ฃผ์ํ์ธ์. ๊ทธ๋๋ ์ด ๋ฐฉ๋ฒ์ ์๋ํ๊ณ ์ถ๋ค๋ฉด ์๋์ ๊ฐ์ด ์
๋ ฅํ์ธ์:
npm audit fix --force
ํ์ํ ๊ฒฝ์ฐ ํ๋ก์ ํธ์ ๋ฐ๋ผ ์ผ๋ถ ํจ์ง ์ค์ ์ ์๋์ผ๋ก ๋ณ๊ฒฝํด์ผ ํ ์๋ ์์ต๋๋ค.
์ ์ ๊ฐ ์ฝ๊ณ ์ถ์ ๋ถ๋ถ๋ง ์ฝ๊ธฐ๋ก ํ์ด์,, ์ผ๋จ ๋ฌด์ํ๊ณ ํ์ธํด๋ณด๋ ์ ์๋ํ๋ค..
๊ตฟ.