Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

downgrade react 18 to 17

npm install --save react@17.0.2 react-dom@17.0.2
Comment

downgrade react version to 17

npm install --save react@17.0.2 react-dom@17.0.2
Comment

How to downgrade from React 18 to React 17

1) From your main folder, delete: 
	a) package-lock.json file (or yarn.lock for yarn) 
	b) node_modules folder (from the terminal you can type 'rm -Rf node_modules')

2) Go to your package.json file and change these dependencies:
    FROM
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    TO
    "react": "^17.0.0",
    "react-dom": "^17.0.0",
    (You can choose the exact version you want to install)

3) Go to index.js file (src/index.js) and edit it the following way:
	a)	Change the import part of index.js:
    	FROM
	    import ReactDOM from 'react-dom/client'
		TO
		import ReactDOM from 'react-dom';
		(you just have to remove the '/client' from the import)
	
	b) Change the below part of index.js:
    	FROM 
        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')
        );

4) Open the terminal and run 'npm install' (or 'yarn install').
Comment

PREVIOUS NEXT
Code Example
Javascript :: if odd js 
Javascript :: jquery all elements whose id contains 
Javascript :: typeerror object(...) is not a function react useParams 
Javascript :: electron communicate between main and renderer 
Javascript :: value is array 
Javascript :: argument vs parameter javascript 
Javascript :: when was react invented 
Javascript :: setlocalstorage 
Javascript :: delete package-lock.json command 
Javascript :: round a number to fixed decimals 
Javascript :: react native build apk 
Javascript :: reactjs firebase where map value 
Javascript :: laravel ajax delete 
Javascript :: set year in javascript 
Javascript :: convert csv to json python using pandas 
Javascript :: ngrok angular 8 
Javascript :: find quotient in javascript 
Javascript :: orthographic camera three js 
Javascript :: : not foundram Files/nodejs/npm: 3: 
Javascript :: get id button clicked react 
Javascript :: js go back 
Javascript :: React Native BUILD FAILED on run-ios 
Javascript :: nuxt small scroll 
Javascript :: get last item in map javascript 
Javascript :: get json by id 
Javascript :: javascript alphabet to number 
Javascript :: give div event listener functional component 
Javascript :: jquery event source 
Javascript :: how to pass token in laravel in jquery ajax 
Javascript :: fetch json file 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =