
๐คทโโ๏ธ react-csv๋?
๋ฆฌ์กํธ๋ก ๊ด๋ฆฌ์๋จ ํ๋ก์ ํธ๋ฅผ ์งํํ๋ค ๋ณด๋ฉด ์์ ํ์ผ, CSV ํ์ผ ๋ฑ๋ฑ ํ์ผ์ ๋ค์ด๋ก๋ ํด์ฃผ๋ ๊ธฐ๋ฅ์ด ํ์ํฉ๋๋ค.

์์ ๊ฐ์ด ๊ธฐ๊ฐ๋ณ, ์ ํ๋ณ๋ก ํต๊ณํ ๋ฐ์ดํฐ๋ค์ CSV ํ์ผ๋ก ๋ค์ด๋ก๋ ํด์ฃผ๋ ๊ธฐ๋ฅ์ ๋๋ค.
๐คทโโ๏ธ react-csv ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ ํํ ์ด์
๋ณดํต์ ์๋ฒ์์ ๋ฐ์ดํฐ๋ฅผ ์ฒ๋ฆฌํด ํ์ผ์ ๋ง๋ค์ด ํ๋ก ํธ์์ ๋ค์ด๋ก๋ ๋ฐ๋ ๋ฐฉ์์ด ๋ง์ด ์ฌ์ฉ๋ฉ๋๋ค.
๊ทธ๋ฌ๋ ์ ๋ ์๋ฒ์์ ํ์ผ์ ์ฒ๋ฆฌํ๊ธฐ๋ณด๋ค ํ๋ก ํธ์์ ์ง์ CSV ํ์ผ์ ๋ค์ด๋ก๋ํ๋ ๊ฒ์ด ๋ ํจ์จ์ ์ด๋ผ๊ณ ํ๋จํ์ฌ react-csv ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํด ๊ธฐ๋ฅ์ ๊ตฌํํ์ต๋๋ค.
์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ํํ ์ด์ ์ค์ ํ๋๋ ์ฃผ๊ฐ ๋ค์ด๋ก๋ ํ์๋ 375,547 ์ด๋ฉฐ ๊ฐ์ฅ ์ต๊ทผ ๊น์ง gitํ๋์ด ์ํํ์ต๋๋ค.
recat-csv ๊ณต์ ์ฌ์ดํธ
https://www.npmjs.com/package/react-csv
react-csv
Build CSV files on the fly basing on Array/literal object of data . Latest version: 2.2.2, last published: 3 years ago. Start using react-csv in your project by running `npm i react-csv`. There are 307 other projects in the npm registry using react-csv.
www.npmjs.com
types/react-csv
https://www.npmjs.com/package/@types/react-csv
@types/react-csv
TypeScript definitions for react-csv. Latest version: 1.1.10, last published: 8 months ago. Start using @types/react-csv in your project by running `npm i @types/react-csv`. There are 38 other projects in the npm registry using @types/react-csv.
www.npmjs.com
๐คทโโ๏ธ react-csv ๋ค์ด๋ก๋
react-csv ๋ค์ด๋ก๋๋ ๊ฐ๋จํฉ๋๋ค.
// npm
npm i react-csv --save
// pnpm
pnpm i react-csv
// yarn
yarn add react-csv
// typescript
npm i --save @types/react-csv
ํ๋ก์ ํธ์ ๋ง๋ ํจํค์ง๋ก ๋ค์ด๋ก๋ ๋ฐ์ผ๋ฉด ๋ฉ๋๋ค.
๐คทโโ๏ธ react-csv ๊ธฐ๋ฅ
react-csv ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ 2๊ฐ์ง ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.
- CSVLink: ์ด ๊ธฐ๋ฅ์ ํด๋ฆญ์ ํ๋ฉด ์์ ํ์ผ์ ๋ค์ด๋ก๋ ๋ฐ์ ์ ์๋ ๊ธฐ๋ฅ์ ๋๋ค.
- CSVDownload: ์ด ๊ธฐ๋ฅ์ ๋ง์ดํธ ๋ ๋ ์๋์ผ๋ก ํ์ผ์ด ๋ค์ด๋ก๋ ๋๋ ๊ธฐ๋ฅ์ ๋๋ค. (๋ง์ดํธ ๋ ๋ ํ์์ ์ผ๋ก ํ์ผ์ ๋ค์ด๋ก๋ ๋ฐ์์ผ๋๋๊ฒ ์๋๋ผ๋ฉด ๊ถ์ฅ๋์ง ์์ต๋๋ค.)
๐คทโโ๏ธ CSVLink ๊ธฐ๋ฅ ์ต์
- data: csv ํ์ผ์์ ๋ฐ์ดํฐ๊ฐ ๋ค์ด๊ฐ๋ ๋ถ๋ถ์ด๋ฉฐ ๋ฐ์ดํฐ๋ ์ด์ค๋ฐฐ์ด, ๊ฐ์ฒด ๋ฐฐ์ด ํน์ ๋ฌธ์์ด ํ์์ผ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค..
- header: csv ํ์ผ์์ ํ๋๋ฅผ ์ง์ ํ ์ ์์ผ๋ฉฐ label๊ณผ key๊ฐ์ ์ค ์ ์์ต๋๋ค.
- filename: ๋ค์ด๋ก๋ ๋ฐ๋ csv ํ์ผ ์ด๋ฆ์ ์ง์ ํ ์ ์์ต๋๋ค.
- onClick: ๋งํฌ๋ฅผ ํด๋ฆญํ ๋ ๋๊ธฐ / ๋น๋๊ธฐ์ ์ผ๋ก ์ฌ๋ฌ ์์ ์ ์ํํ๊ณ ์ ํ ๋ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์ฌ์ฉ๋ฒ ์์
const headers = [
{ label: "First Name", key: "firstname" },
{ label: "Last Name", key: "lastname" },
{ label: "Email", key: "email" }
];
const data = [
{ firstname: "Ahmed", lastname: "Tomi", email: "ah@smthing.co.com" },
{ firstname: "Raed", lastname: "Labes", email: "rl@smthing.co.com" },
{ firstname: "Yezzi", lastname: "Min l3b", email: "ymin@cocococo.com" }
];
<CSVLink
data={data}
headers={headers}
filename={'CSV ๋ฐ์ดํฐ'}
onClick={() => {
console.log("๋งํฌ ํด๋ฆญํจ");
}}
>
Download me
</CSVLink>;
์ฝ๋์์ ๋ณด๋ ๊ฒ์ฒ๋ผ header์ ํ๋๋ฅผ ์ ํ ํ ์ ์๊ณ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ฒด ๋ฐฐ์ด๋ก ์ ํ ํ ํด์ ์ํ๋ ๋ฐ์ดํฐ๋ฅผ ๋ณผ์ ์๋๋ก CSV ํ์ผ์ ๋ง๋ค์ ์์ต๋๋ค.
CSVLink onClick ์์
const headers = [
{ label: "First Name", key: "firstname" },
{ label: "Last Name", key: "lastname" },
{ label: "Email", key: "email" }
];
const data = [
{ firstname: "Ahmed", lastname: "Tomi", email: "ah@smthing.co.com" },
{ firstname: "Raed", lastname: "Labes", email: "rl@smthing.co.com" },
{ firstname: "Yezzi", lastname: "Min l3b", email: "ymin@cocococo.com" }
];
<CSVLink
data={data}
headers={headers}
filename={'CSV ๋ฐ์ดํฐ'}
onClick={() => {
if (confirm('csvํ์ผ์ ๋ค์ด๋ก๋ ๋ฐ๊ฒ ์ต๋๊น?')) {
return true;
} else {
return false;
}
}}
>
Download me
</CSVLink>;
๋ค์ด๋ก๋ ์ ์ ํ์ธ ์ฐฝ์ ๋์, ํ์ธ์ ๋๋ฅด๋ฉด true, ์ทจ์๋ฅผ ๋๋ฅด๋ฉด false๋ฅผ ๋ฐํํ๋๋ก ์ค์ ํ ์ ์์ต๋๋ค.

react-csv ํ์ผ ๋ค์ด๋ก๋ ๋ฐ์ ํ์ผ

๐คทโโ๏ธ ๋ง์ง๋ง์ผ๋ก
react-csv ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํด ํ๋ก ํธ์๋์์ ํ์ผ ๋ค์ด๋ก๋ ๊ธฐ๋ฅ์ ๊ตฌํํ์ต๋๋ค.
์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ๋ ๊ฐ์ง ์ฃผ์ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ฉฐ, ์ํฉ์ ๋ง๊ฒ ์ ํํด ์ฌ์ฉํ ์ ์์ต๋๋ค.
ํนํ CSVLink๋ ๋ค์ํ ์ต์ ์ ์ ๊ณตํ์ฌ ํ์ผ ๋ค์ด๋ก๋๋ฅผ ์ฝ๊ฒ ์ปค์คํฐ๋ง์ด์งํ ์ ์์ด ๊ฐํธํ๊ฒ ์์ ํ์ผ ๋ค์ด๋ก๋ ๊ธฐ๋ฅ์ ๊ตฌํํ ์ ์์ต๋๋ค.
์ฌ๋ฐ๋ ์ค๋์ ๋ ๋ณ ์ด์ธ ๋ณด๊ณ ๊ฐ์ธ์!

https://cometruedream.tistory.com/247
[React] Tailwind ํ์ค, ๋์ค, ์ธ์ค ํจ๊ณผ className ์ปค์คํ
๐คทโโ๏ธ Tailwind ํ์ค, ๋์ค, ์ธ์ค ํจ๊ณผํ๋ก์ ํธ ์งํ์ค ๋ฐฐ๋ ๋งํฌ์ URL ๊ธธ์ด๊ฐ ๋๋ฌด ๊ธธ์ด์ 3์ค ํจ๊ณผ ์ฒ๋ฆฌ๋ฅผ ํด์ผ ํ์ต๋๋ค. React + Tailwind CSS ์ ํ ๋ ํ๋ก์ ํธ ์ฌ์ CSS ํ์ผ & style ํ๊ทธ๋ฅผ ์ฌ์ฉํ
cometruedream.tistory.com
https://cometruedream.tistory.com/243
NestJS Lifecycle (์๋ช ์ฃผ๊ธฐ) ๊ฐ๋
๐คทโโ๏ธ ๋ณธ๋ก ์ ์์ Nest JS ๊ฐ๋ ?Nest JS๋ Node JS ๊ธฐ๋ฐ์ผ๋ก ํ ์๋ฒ ์ดํ๋ฆฌ์ผ์ด์ ํ๋ ์์ํฌ ์ ๋๋ค. ์๋ฐ์คํฌ๋ฆฝํธ๋ ์๋นํ ์ค๋ซ๋์ Express ๊ธฐ๋ฐ์ผ๋ก ์๋ฒ ์ดํ๋ฆฌ์ผ์ด์ ๊ฐ๋ฐ์์ ์๋์ ์ธ ์
cometruedream.tistory.com
https://cometruedream.tistory.com/242
๋ฆฌ์กํธ Vite Proxy ํ์ฉํ CORS ์ค๋ฅ ํด๊ฒฐ
๐คทโโ๏ธ ๋ณธ๋ก ์ ์์ํ๋ก ํธ์๋ ๋ฒ๋ค๋ฌ ๊ฐ๋ ๊ณผ webpack vs vite ๋น๊ต์ ๋ํด์ ๊ณต๋ถ๋ฅผ ํ๊ณ ๊ธ์ ๋ณด์๋ฉด ๋ ๋ง์ ๋์์ด ๋ฉ๋๋ค^^ํ๋ก ํธ์๋ ๊ฐ๋ฐ์ ์ํ ๋ฒ๋ค๋ฌ ๊ฐ๋ ๊ณผ webpack vs vite ๋น๊ตhttps://comet
cometruedream.tistory.com
https://cometruedream.tistory.com/241
React ํด๋๊ตฌ์กฐ FSD ๊ธฐ๋ฅ ๋ถํ ์ค๊ณ ์ํคํ ์ฒ
๐คทโโ๏ธ ๋ณธ๋ก ์ ์์ํ๋ก์ ํธ๋ฅผ ์์ํ๊ธฐ์ ์์ ํด๋ ๊ตฌ์กฐ, ์ค๊ณ์ ๋ํ ์ํคํ ์ฒ๋ฅผ ๋ง๋๋ ๊ฒ์ ์๋นํ ์ด๋ ต๋ค. ์ด๋ฒ ํ๋ก์ ํธ์ React FSD ํด๋๊ตฌ์กฐ ์ํคํ ์ฒ๋ฅผ ์ค๊ณํ ์์ ์ด๋ผ์ FSD ์ํคํ
cometruedream.tistory.com
https://cometruedream.tistory.com/244
์ฝ๊ฒ ์ดํดํ๊ณ ์ฌ์ฉํ ์ ์๋ Prisma ๋ช ๋ น์ด ์ ๋ฆฌ
๐คทโโ๏ธ Prisma ๋ช ๋ น์ด ๋ณธ๋ก ์ ์์ Prisma๋?Nest JS ํ๋ ์์ํฌ์ Prisma ORM์ ํ์ฉํด์ ํ๋ก์ ํธ๋ฅผ ์งํํ๋ฉด์ Prisma๋ Node JS ๊ธฐ๋ฐ์ ํ๋ ์์ํฌ/๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ํธ์์ฉ์ด ์๋๋ฉฐ Prisma + DB ์ฐ๋์ผ
cometruedream.tistory.com
'React' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Next.js 14 Middleware๋ฅผ ํ์ฉํ ๋ก๊ทธ์ธ ํ์ด์ง ๋ฆฌ๋ค์ด๋ ์ ๋ฐฉ๋ฒ (1) | 2024.10.15 |
---|---|
NextJS์์ Prisma๋ฅผ ์ฌ์ฉํ Vercel์ ๋ฐฐํฌ ์ค๋ฅ ํด๊ฒฐ ๋ฐฉ๋ฒ (2) | 2024.08.09 |
React ๊ฐ๋ฐ์๋ฅผ ์ํ TypeScript์ Hooks ์ฌ์ฉ ํ ๋ฐ ์์ (1) | 2024.08.08 |
๋ฆฌ์กํธ ์ ์ด vs ๋น์ ์ด ์ปดํฌ๋ํธ ์์๋ณด๊ธฐ (0) | 2024.08.02 |
๋ฆฌ์กํธ useLayoutEffect ๊ฐ๋ ๋ฐ ์ฌ์ฉ๋ฒ (36) | 2024.07.31 |