Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react 18

import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);
Comment

React 18 to 17

    When You Using

npx create-react-app app-name

it will always install latest react packages. Then, in react 18.2.0, It is some of different about previous version.

    If you want to downgrade your current react version to previous version of react, Try These 5 Steps.

    You go to your folder file structure and delete both package-lock.json ( yarn.lock for yarn) file and node_modules file.

    After you go to your package.json file and change and edit these dependencies :

"react": "^18.2.0",
"react-dom": "^18.2.0",

to

"react": "^17.0.2",
"react-dom": "^17.0.2",

in your package.json dependencies file like this.

    After go to Your index.js file change,

import ReactDOM from 'react-dom/client'

to

import ReactDOM from 'react-dom';

    After change your index.js file and change below part of index file.

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

to

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

    Finally, You can open the terminal and run

if you are using npm -->> npm install

Comment

React 18.2

npm install react@rc react-dom@rc
Comment

PREVIOUS NEXT
Code Example
Javascript :: chatbot js 
Javascript :: JavaScript (rhino 1.7.9) sample 
Javascript :: online convert python to javascript 
Javascript :: emberjs cdn 
Javascript :: how to convert roman to decimal in javascript 
Javascript :: user authentication and routing + nodejs + express 
Javascript :: port y build - vite.config.js 
Javascript :: ref.current.selectionStart 
Javascript :: operadores de asignacion javascript 
Javascript :: javascript Implicit Conversion to String 
Javascript :: expo create react native app command 
Javascript :: JavaScript Access Symbol Description 
Javascript :: javascript map size 
Javascript :: date methods javascript 
Javascript :: JavaScript Comparison and Logical Operators 
Javascript :: find the missing number in js 
Javascript :: dropzone sending event add additional data 
Javascript :: mongoose findbyidandupdate or findoneandupdate 
Javascript :: javascript döngü dizisi 
Javascript :: how to generate random 6 digit charecter in js for coupon 
Javascript :: phaser generate frame names 
Javascript :: Node.js technical interview samples 
Javascript :: after end time run function 
Javascript :: javascript concat two htmlcollection 
Javascript :: mogoose schema to add json as a property 
Javascript :: change firebase email on login 
Javascript :: select and select based on value in jquery 
Javascript :: event listener 
Javascript :: setimmediate node example 
Javascript :: vanilla js 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =