- 2
Good morning sir. I have error line 17. I want export import. Thanks you sir.
error line 17. Export import React. https://code.sololearn.com/WB441Fiv0xiG/?ref=app
1 Réponse
0
On sololearn we cant use import for local files only from cdn, but if you have problem on your local machine, make sure you are pointing to right path for component
// child you will export/import
function ComponentName () {
return (
<div>Something to render</div>
)
}
export default ComponentName;
// in parent
import ComponentName from "path";
function App() {
return <ComponentName/>
}
// path point to location ./filename is if component is in same folder as parent component
// for some folder you do ./folderName/componentName
// also with ../ you go back one directory look on internet for better explanation