reactjs / React.NET

.NET library for JSX compilation and server-side rendering of React components
https://reactjs.net/
MIT License
2.28k stars 940 forks source link

'ReactDOM' is not defined no-undef problem occurs while running this script? #1243

Open naveen2103 opened 3 years ago

naveen2103 commented 3 years ago

Screenshot 2021-03-18 at 6 08 08 PM

code i used :

import ReactDOM from 'react-dom'; import React from 'react';

const App= () =>(

Hello first React project

)

ReactDOM.render(,document.getElementById('root'))

error i got : Failed to compile.

src/index.js Line 14:1: 'ReactDOM' is not defined no-undef

Search for the keywords to learn more about each error.

naveen2103 commented 3 years ago

can any one help me to solve this problem and say why it occurs because i beginner to this reactjs

Eskabore commented 3 years ago

You just have have to correct "import ReacrDOM from ...." into "import ReactDOM from react-dom" The letter 'r' has to be replaced by 't' and give you and also, my advise will be to always put "import React from ...." on top

import ReactDOM from 'react-dom';
import React from 'react';

Make sure to close the issue and it would be great to leave me a star on my profile. You can also fork this Todo-list and get a full ReactJS template project. I am a ReactJS developer and will gladly help you if you have further questions or require an advice on this topic. 👍🏾 Eskabore

Nishikanta30 commented 2 years ago

import React from "react"; import ReactDOM from "react-dom"; import Heading from "./Heading"; import Para from "./Para"; import List from "./List" function App(){ return ( <>

</> ); }

export default App;

Nishikanta30 commented 2 years ago

src\index.js Line 4:1: 'ReactDom' is not defined no-undef Line 6:2: 'App' is not defined react/jsx-no-undef

Search for the keywords to learn more about each error.

bravol commented 2 years ago

ReactDOM and ReactDom are different words, check your spelling ,it should be ReactDOM. React is case sensitive

ThulaMabota commented 2 years ago

Thank you for the response, I experienced the same problem then capitalized DOM then everything worked.

Bobby-GMS commented 7 months ago

This is my code: import ReactDOM from 'react-dom'; import React from 'react'; import './index.css'; import App from './App';

const root = ReactDOM.createRoot(document.getElementById('root'));

root.render( <>

</> )

and this is the error I'm getting:

[eslint] src\root.js Line 1:21: 'ReactDOM' is not defined no-undef Search for the keywords to learn more about each error. ERROR in [eslint]

I need Help Please!