//This is the greet.js file
import React from "react"; functionGreet() { return () } export default GreetWelcome
//This is the indx.js file
import React,{Component} from 'react' import Greet from './Greet' class App extends Component { render() {} }
//This is an html file
Here We Go
I'm trying to get data from greet.js and render it in indx.js, but I get the Cannot use import statement outside module error
type='module'
to thescript
tag to use theimport/export
syntaxbabel
,esbuild
, or your favorite compiler on the server, or typebabel
directly into HTML. You can also usevite