I have created a basic create-react-app and added the below statement
const [stateA, setStateA] = useState(false); and I have put a console.log inside my component. The complete component code is
import React, { useState } from 'react'; import logo from './logo.svg'; import './App.css'; const App = () => { const [stateA, setStateA] = useState(false); console.log("rendered"); return ( <div className="App"> <header className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <p> Edit <code>src/App.js</code> and save to reload. </p> <a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer" > Learn React </a> </header> </div> ); } export default App; It is showing "rendered" twice. Can any one tell why this is happening ?
StrictModecomponent which rendering components multiple times to catch side effects inside renders