Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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 :: javascript exponential 
Javascript :: sequelize association helper methods 
Javascript :: javascript online test 
Javascript :: moment localization 
Javascript :: convert table to excel reactjs 
Javascript :: jsx inline style 
Javascript :: delete row in html table using javascript 
Javascript :: no special characters express validator 
Javascript :: get data from url using react 
Javascript :: react hooks vs redux 
Javascript :: ordering array 
Javascript :: constant values javascript 
Javascript :: javascript timestamp to date 
Javascript :: display image on button click javascript 
Javascript :: javascript copy items into another array 
Javascript :: javascript change all text color 
Javascript :: js find integer 
Javascript :: index of row jquery 
Javascript :: moment set time 
Javascript :: TypeError: JSON.stringify(...).then is not a function 
Javascript :: how to use useeffect 
Javascript :: react usecallback 
Javascript :: get param is react 
Javascript :: share to gmail from website 
Javascript :: copy element jquery 
Javascript :: react native flexbox 2 columns 1 fixed width 
Javascript :: webpack babel loaders/plugin installation 
Javascript :: js .touppercase 
Javascript :: react native dotenv 
Javascript :: get all matches regex javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =