am using useState in my functional component in react ! am just confused about something
[myRoom,setMyRoom] = useState('test1');
when i use for example this function setMyRoom to set my room inside a method , it dose not change the value until the second re-redner
function(){
setMyRoom("test 2")
console.log(myRoom)
// here i get test1 from the first line but not (test2) !!
//why don't i get it immediately?
//how can i get it before the re-render?
}
a second question, what is the difference between using setState and using normal JS ? myRoom= 'test2'