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.
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();
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
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.
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.
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:
In working directory:
npm install @types/react-dom --save
And in settings, check local node_modules folder, only those two should be checked.
Now, everything will work as expected:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With