How to prevent re-rendering of components that have not changed?
Personally I would avoid React.memo / React.useRef / React.useCallback. The simplest solution to your example is just create another component, and store the state with this. eg. const Button = () => { console.log(“Button Rendered!”); window.alert(“Button Rendered”); return <button onClick=””>Press me</button>; }; const TextInput = () => { const [textInput, setTextInput] = useState(“Hallo”); const onChangeInput … Read more