관리 메뉴

웹개발 블로그

[JS] 라이브러리란? 본문

◆React.js & Next.js & Node.js/Node.js(실행환경)

[JS] 라이브러리란?

쿠키린 2025. 1. 26. 22:37

프로그램을 개발할 때 필요한 다양한 기능들을

미리 만들어 모듈화 해 놓은것.


npm 백화점

 

https://www.npmjs.com/

 

npm | Home

Bring the best of open source to you, your team, and your company Relied upon by more than 17 million developers worldwide, npm is committed to making JavaScript development elegant, productive, and safe. The free npm Registry has become the center of Java

www.npmjs.com

 

검색창에 react를 입력해보면

react에서 사용가능한 라이브러리들이 검색된다.

 

 

👀예시

https://www.npmjs.com/package/randomcolor?activeTab=dependents

 

randomcolor

A tiny script for generating attractive random colors. Latest version: 0.6.2, last published: 5 years ago. Start using randomcolor in your project by running `npm i randomcolor`. There are 403 other projects in the npm registry using randomcolor.

www.npmjs.com

install 명령어

 

터미널에서 입력 해보자

 

🔽 아래 화면처럼 변화가 생긴다.(원래 빨간 네모는 없었음.)

 

해석 : 이제부터 이 프로젝트는 randomcolor를 의존 하겠다!


✅ (추가로) randomColor 라이브러리 설치 및 사용법

import randomColor from "randomcolor";
const color = randomColor();
console.log(color); //예시 : #63ff85