javascriptreactjsiconsfont-awesomereact-icons

I am trying to add icons in my react app but this method not working Need help and guidance


package.json file

  {
  "name": "myapp",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.2.0",
    "@fortawesome/free-regular-svg-icons": "^6.2.0",
    "@fortawesome/free-solid-svg-icons": "^6.2.0",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-icons": "^4.4.0"
  },
  "devDependencies": {
    "@types/react": "^18.0.17",
    "@types/react-dom": "^18.0.6",
    "@vitejs/plugin-react": "^2.1.0",
    "autoprefixer": "^10.4.12",
    "postcss": "^8.4.16",
    "tailwindcss": "^3.1.8",
    "vite": "^3.1.0"
  }
}

icontext component here i am trying to add social media icons:

   import React from 'react'


const IconsText = () => {
  return (
   <div className="container-fluid bg-[#1d3943]">

   </div>

  )
}

export default IconsText

I don't know what i am doing wrong i tried add code but failed what should I do to add icons


Solution

  • Check out the font awesome guide on importing icons in react