Hello guys. A question about React JS... I want to import an icon from index.js and use the referenced name inside App.js class... is it possible? Thanks in advance

Apr 7, 2022, 10:40 AM
if you created the react app using creat-react-app yes, you can import it and then use it like
Apr 7, 2022, 10:44 AM
I'm using that inside App.js and the import in index.js but it doesn't work! It only works if I import it inside App.js
Apr 7, 2022, 10:45 AM
yeah because the import is managed by a library that is used inside the react app
index.js is the entry point for the react app but its not the react app
you can import it inside app.js because there's a library called file-loader that makes it for you so it wont work outside the react app scope
Apr 7, 2022, 10:47 AM

© 2024 Draquery.com All rights reserved.