Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved function or method render() for React Hello-World app in IntelliJ

I used create-react-app to create a hello-world React application, then I used IntelliJ IDEA to open the application. But there is a warning for the index.js as following. I was wondering how to get rid of this warning.

enter image description here

This is a hello-world application created by create-react-app and I guess it needs to install some library in IntelliJ IDEA:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';

ReactDOM.render(
    <App />,
    document.getElementById('root')
);
registerServiceWorker();
like image 494
Thomas Avatar asked Sep 29 '17 19:09

Thomas


People also ask

How to make Hello world react app (2019)?

React Hello World: Your First React App (2019) 1 Generate a New React App Using Create React App 2 Run the React App 3 Understand the Folder Structure 4 Install Additional React Libraries 5 Create a Hello World React Component 6 Use the Hello World React Component 7 Wrapping Up

What is react in IntelliJ?

React. React is a JavaScript library for building complex interactive User Interfaces from encapsulated components. Learn more about the library from the React official website.. IntelliJ IDEA integrates with React providing assistance in configuring, editing, linting, running, debugging, and maintaining your applications.

Is Hello World a good example of a React component?

Yes, it’s trivial, but the Hello World React component above is actually a really good example of a first React component. Why? Because it has both view code and logic code.

How to create an application in ReactJS?

Step 1: Create a react application using the following command It takes a couple of minutes to install the packages. Step 2: Once it is done change your directory to the newly created application using the following command Project Structure: It is created as shown below. Step 3: Now inside App.js and write down the following code as shown below:


1 Answers

In working directory:

npm install @types/react-dom --save

And in settings, check local node_modules folder, only those two should be checked.

settings window

Now, everything will work as expected:

Works now

like image 109
kodisha Avatar answered Oct 22 '22 10:10

kodisha