I am using CSS module. Does it affect in how to add the Font awesome icon? I already installed all the required dependencies.
nav.js
import React from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import classes from "./Nav.module.css";
import Button from "../UI/Button/Button";
const Nav = (props) => {
return (
<section className={classes.nav}>
<h1>ReactMeals</h1>
<Button className={classes["nav--btn"]}>
<FontAwesomeIcon icon={["fa-solid", "fa-cart-shopping"]} />
Your Cart
<span className={classes["num__items"]}>0</span>
</Button>
</section>
);
};
export default Nav;
package.json
{
"name": "foodorderapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-regular-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Tried to through Font awesome documentation. But it didn't work.