DEV Community

Athira P S
Athira P S

Posted on

βš›οΈ React 19 + FontAwesome = broken? Here's why and how to fix it. 🧡

I ran into this while building an HR software project with React 19, Vite, Node.js and MongoDB.

πŸ”΄ The error:
"Invalid hook call" + "Cannot read properties of null (reading 'useId')"

πŸ” 3 things that were wrong:

1️⃣ Missing package
@fortawesome/react-fontawesome was never installed β€” only the core and icon packages were. Without it, there's no React component to render icons at all.

2️⃣ Wrong FA version
v7 of FontAwesome is the Pro version. If you're using free icons, you need v6.

3️⃣ React 19 compatibility
FA's older packages used React hooks internally. React 19 changed how hooks are registered, causing the null 'useId' crash.

βœ… Correct setup for React 19:
npm install \
@fortawesome/react-fontawesome@latest \
@fortawesome/fontawesome-svg-core@^6.7.2 \
@fortawesome/free-solid-svg-icons@^6.7.2

πŸ—οΈ Project context:
Building a full-stack HR Management System β€” Employees, Attendance, Payroll, Leave Management β€” using React 19, Node.js, Express and MongoDB. Excited to share more soon!

Follow along if you're into full-stack builds πŸš€\

Top comments (1)

Collapse
 
shabeeralavicodez profile image
ShabeerAlavi-Codez

πŸ”₯Great catch! Sometimes the smallest dependency mismatch causes the biggest debugging headache. Thanks for sharing the fix.