score:1
You have to add babel
to use JSX
. And the id
of the root element should match the id
in the ReactDOM.render
function
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="#">
<title>List</title>
</head>
<body>
<div id="root"></div>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
<script type="text/babel">
const myelement = <h1>Hello World</h1>;
ReactDOM.render(myelement, document.getElementById('root'));
</script>
</body>
</html>
Source: stackoverflow.com
Related Query
- Uncaught Error: Expected `onClick` listener to be a function, instead got a value of `object` type
- useAutocomplete Uncaught TypeError: Cannot read property 'filter' of undefined or Expected an assignment or function call and instead saw expression
- Uncaught SyntaxError: expected expression, got '< with react
- Uncaught SyntaxError: expected expression, got '<'
- Uncaught Error: Expected `onClick` listener to be a function, instead got a value of `object` type. ReactJS
- Uncaught Error: Expected onClick listener to be a function, instead got type string
- Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function but got: object
- ReactJS giving error Uncaught TypeError: Super expression must either be null or a function, not undefined
- React: Expected an assignment or function call and instead saw an expression
- ReactJS: Expected onClick listener to be a function, instead got type string
- react native - expected a component class, got [object Object]
- Expected onClick listener to be a function, instead got type object - react redux
- React+Redux - Uncaught Error: Expected the reducer to be a function
- React + Redux-router = Uncaught Error: Expected the reducer to be a function
- Typescript is giving me an error: Expected 0 arguments, but got 1
- React: expected an assignment or function call and instead saw an expression no-unused-expressions
- Expression Expected in React using Switch Statement
- React Native Element type is invalid expected a string but got undefined
- React Memo Feature gives :- Uncaught Error: Element type is invalid: expected a string but got: object
- Typescript Error on super(): expected 1-2 arguments, but got 0
- Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object
- Expected an assignment or function call and instead saw an expression error
- Redux createStore<StoreState> produces an error: Expected 4 type arguments, but got 1
- TypeScript Error - Expected 1-2 arguments, but got 0 or more. TS2556
- SassError: Invalid CSS expected expression (e.g. 1px, bold)
- Expected 0 arguments, but got 1.ts(2554) when implement redux use typesafe-actions for action
- p5 js in react : Expected an assignment or function call and instead saw an expression no-unused-expressions
- I got the error unclosed regular expression in my jsfiddle
- Expected ASGI message 'websocket.accept' or 'websocket.close', but got 'http.response.start'
- React Redux dispatch function: Expected 0 arguments, but got 1 TS2554
More Query from same tag
- How to print digit 5 or 6 in reactjs number validation
- TypeScript AuthContext cant take undefined when on Routes
- Splicing items from an array in a for loop, get typeerror
- React Paginate Second Instance on same page does not re render
- How to reflect form validation error changes to CSS?
- Removing item from cart Redux, React
- How to show different Navbars based on authentication status and role?
- how can i fix concurrently issue running multiple scripts
- Why doesn't second (sibling) React Context Provider work? Or, why doesn't a React Context Provider work if there is a sibling Context Provider above
- Can I query a field inside nested Document in firestore?
- How do I subtract date from today's date in React?
- Cannot read properties of null (reading 'useRef') error
- If I create custom Button with material-ui ButtonGroup doesnt work
- React Redirect if this.props.location.state is null
- What is the difference between yarn build and yarn install?
- react state change doesn't work as expected
- React / Redux - Get Details from Url ID
- how to write html tags inside a react object
- From where does Relay fetch the Schema of GraphQL?
- How can i map all collections inside of collection in firebase with React?
- How do I test an onKeyDown event on the whole document page for a pop up?
- Calling addEventListener after setState seems to run event twice
- Controlling conditional alert, and scrolling towards it in ReactJS
- react-chartjs-2 Line graph doesnt update with data
- Framer Motion not updating scrollYProgress
- Making components with curly brackets versus parenthesis when using functional components
- React hooks - useEffect method keeps fetching
- Hiding or not producing axis lines inside first circular grid
- Data state of component resetting to it's initial value after making the action of deleting a row in ReactTable
- showing only first element from data