Next 15 and Lucide React load and render icons dynamically
reactjs - Module not found: Can't resolve 'D:\NextJs\trial-app\node_modules\lucide-react\dist\cjs\icons\check' - Stack Overflow
How a write a function that receives a component then adds some parameter to it then returns the new component
X Icon (formerly twitter) request
What is lucide-animated?
Is lucide-animated free to use?
What technologies are used in lucide-animated?
Videos
Β» npm install lucide-react
Problem:
I am working on a project where we have to generate a sidebar menu dynamically. So we store all the menu items in a DB, load then when component renders and construct the sidebar. Until this point its working correctly. I am using Lucide react icons, I want to load the icon dynamically and display it in the sidebar. This functionality has two problems:
-
The icons loads properly but there is a delay. The menu items load first and then all icons pop in after a small delay.(Delay is small but clearly noticeable)
-
We are showing the preview for the Sidebar to the user. So he can open/close and test the placement of items in the menubar. Here also the icons load/pop-in with a small delay and this repeats whenever the user clicks on a menubar item.
What is the potential solution ? I don't want to load all the icons in the component at once.
Β» npm install lucide-react-native
I had same error. The workaround is to downgrade lucide-react to 0.263.1
npm install [email protected]
This is an issue from the new Nextjs upgrade, but there are easy workaround, you can just import from your node modules like:
import { Sun, Moon } from '../../node_modules/lucide-react';
Or downgrade your Lucide react to "lucide-react": "0.263.1", just
npm install [email protected]