JS.React. Wow! SetState is async )
The discussion is here.
In my code i did like this to get the proper result of the state
setMyName(myName, f) { this.setState({myName}, ()
The discussion is here.
In my code i did like this to get the proper result of the state
setMyName(myName, f) { this.setState({myName}, ()
Example
const handleRightClick = (e) => { const house = document.getElementById(‘1’); // << vanila js :)) if (house) house.setAttribute(‘margin-left’, ‘200px’); house.style.marginLeft = ‘100px’; }
import React {Component, useState} from ‘react’; // destruct here … class House extends Component // for example // or example from docs class Welcome extends