Exports& Imports Modules in React

_jouz_ryul·2020년 1월 24일
0

#when export and import modules or components, it was bit confusing with wrapped with brackets while somes are just declared as it is as written in its own script or with other new variable where has been imported.
For example, I saw three cases using React.js such as

import React from 'react
import {Idk} from 'somewhere.js'
import classcomponent from 'Component.js'
So today, I want to get through little deeper with these cases or exporting and importing modules breifly and quickly


default export and named export

person.js

utility.js

app.js


One more Thing with named export


we also can use it like a example below

one more another Thing


This is a kind of method have learned from bootcamp mentor and had been helpful during the project.
This method is simply just creating a new file, named index.js in the same folder with the js file that needed to be exported.

someThing.js

index.js

and in the script file where to import someThing.js

in this case, with a huge project which will have trmendous folders and files and makes us to find all the directories in deep depth, I call traffic of Project, we could just wrtie a directory until the folder.

profile
개발신생아

0개의 댓글