Below you will find pages that utilize the taxonomy term “React-Scripts”
Post
read more
How to use absolute imports with React
Starting from React scripts you can now use absolute imports to use your components.
What’s the problem?
Imagine you have the following simple code structure.
/src
--/Components
--/Home/Top.js
--/A/Really/Deep/Component.js
--App.js
If you wanted to import, say… Top into App, you would normally do:
App.js
import Top from './Home/Top'
So what’s the problem?
Imagine you want to import Top into Component, then you would have:
import Top from '../../../../Home/Top'
Did you count the folders I went back? I didn’t so it might not match.