React Components
One of the most efficient ways to advance as a progammer is to react to the ever evolving environment. I recently learned React, while studying I found one of the quickest way to build a complex application is to use component libraries. A component library is a npm package that contains components that other developers have graciously offered to you! Still confused on how to install a library or why this is even useful…?
When using component libraries features like buttons, cards, clocks, tables, loading spinners, etc… can be created by just using the react component that was imported. One of the most popular libraries is React Bootstrap, I will help you get that installed and usable.
Get Templetl’s stories in your inbox
Join Medium for free to get updates from this writer.
Step 1.
The first thing you must do is install the package. Navigate to the terminal and choose your working directory. Once in the same folder as the node modules for the react app type command “npm i react-bootstrap”
Step 2.
After the package is installed open the app javascript file and start import components from react-boostrap. For example at the top of app.js type
import { Button } from ‘react-bootstrap’
Step 3.
Navigate to spot the button should be placed adding the component is incredibly easy from here its as simple as using any other react component throughout your file. For example inside the return statement of your component type <Button />.
Step 3.5…
Sometimes pre bundled components use other pre bundled items from different libraries, I personally ran into errors displaying the icons from the library I used. After reading the terminal it seemed I was missing something called @heroicons. If you run into this error type in google “npm i @heroicons” The possibilities when using a library are limitless, never be afraid to look around on google because a 3 minute search could save you 30 minutes of coding and debugging.







