Describe the bug
👋🏼
I noted today that I was getting mismatches between the logged state and the rendered state in a very simple react application. I'm probably missing something but I'm at my wits end.
This is only an issue when running the development server. Running the built application does not have this issue.
Did you try recovering your dependencies?
Environment
Environment Info:
current version of create-react-app: 4.0.3
running from /home/sqve/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
System:
OS: Linux 5.13 Arch Linux
CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Binaries:
Node: 14.17.6 - ~/.local/share/nvm/versions/node/v14.17.6/bin/node
Yarn: 1.22.11 - ~/.local/share/nvm/versions/node/v14.17.6/bin/yarn
npm: 7.22.0 - ~/.local/share/nvm/versions/node/v14.17.6/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 4.0.3 => 4.0.3
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
- Run
npx create-react-app state-mismatch.
- Change the default
App into:
import { useState } from "react";
const getRandomString = () => Math.round(Math.random()).toString();
export function App() {
const [state, setState] = useState([getRandomString()]);
console.log(state);
return <div className="App">{state.map((x) => x)}</div>;
}
export default App
- Run
yarn run start and refresh until there is a mismatch.
Expected behavior
The state should always be the same.
Actual behavior
There's a mismatch between what the console outputs and what is rendered.

Describe the bug
👋🏼
I noted today that I was getting mismatches between the logged state and the rendered state in a very simple
reactapplication. I'm probably missing something but I'm at my wits end.This is only an issue when running the development server. Running the built application does not have this issue.
Did you try recovering your dependencies?
Environment
Steps to reproduce
npx create-react-app state-mismatch.Appinto:yarn run startand refresh until there is a mismatch.Expected behavior
The state should always be the same.
Actual behavior
There's a mismatch between what the console outputs and what is rendered.
