In the following example, clicking the name change button does change the state, however that is not rendered on the UI.
The correct expected result is to change the name to "Mike":
here is SandBox
import React, { useState } from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const useForm = initialValues => {
const [values, setValues] = useState(initialValues);
return [
values,
e => {
console.log(e.target.value);
setValues({
...values,
[e.target.name]: e.target.value
});
}
]
}
let count = 0;
const Hello = (props) => {
console.log(`Hello.props: ${props.name} `)
const [values, handleChange] = useForm({ nameInput: props.name });
count++
console.log(`RenderedAmount: ${values.nameInput} : ${count}`)
return (
<div>
Name: <input value={values.nameInput} onChange={handleChange} name="nameInput" /><br/>
Hello {values.nameInput}!
</div>
);
}
const Container = (props) => {
const [ name, setName] = useState(props.name);
console.log(`Container: Name is ${name}`)
return(
<div>
<Hello name={name}/>
<button onClick={()=>{setName("Mike")}}>
Change Name
</button>
</div>
)
}
const rootElement = document.getElementById("root");
ReactDOM.render(<Container name="John"/>, rootElement);
cialis for daily use
online free dating service
the study and dating of tree rings is called?
gay black male dating
gay dating sites site
sacramento gay dating sites
gay dating grindr
fab gay dating
gay bear teen dating
gay dating men with six packs
gay dating site / circa 2004
dating sites for gay men
Ahaa, its nice dialogue concerning this paragraph here at this web site, I have read all that, so
at this time me also commenting at this place.
Thanks for a marvelous posting! I genuinely enjoyed reading it, you’re a great author.I will
make sure to bookmark your blog and definitely will come
back down the road. I want to encourage you to definitely continue your great job, have
a nice holiday weekend!
Hello, this weekend is good in support of me, as
this moment i am reading this enormous educational article here at my home.
This is my first time go to see at here and i am actually impressed to read all at one place.
I got this web page from my friend who shared with me about this
website and now this time I am visiting this site and reading very informative content here.
gay dating after 40
gay chubby chasers dating
[url=”http://gaychatgay.com?”]best online gay dating site[/url]
This web site truly has all the information I needed about this subject and didn’t know
who to ask.
Aw, this was a really good post. Spending some time and actual effort to generate a good article… but what can I say… I procrastinate a whole lot and
never seem to get nearly anything done.
We are a group of volunteers and opening a new scheme in our community.
Your site offered us with valuable information to work on. You’ve
done a formidable job and our entire community will
be grateful to you. asmr https://app.gumroad.com/asmr2021/p/best-asmr-online asmr
Spot on with this write-up, I actually think this
site needs much more attention. I’ll probably be back again to read more, thanks for the information! quest
bars http://j.mp/3jZgEA2 quest bars
Hi there! I understand this is kind of off-topic however
I had to ask. Does building a well-established blog like yours take a large amount of work?
I’m brand new to blogging but I do write in my journal
every day. I’d like to start a blog so I can share my own experience and thoughts
online. Please let me know if you have any recommendations or
tips for brand new aspiring blog owners. Thankyou!
ps4 https://j.mp/3z5HwTp ps4
Hurrah, that’s what I was exploring for, what a stuff!
present here at this weblog, thanks admin of this
website. cheap flights http://1704milesapart.tumblr.com/ cheap flights
Thanks to my father who told me concerning this web site,
this blog is truly amazing. scoliosis surgery https://0401mm.tumblr.com/ scoliosis surgery
Heya! I know this is sort of off-topic however I needed
to ask. Does managing a well-established blog like yours require
a lot of work? I’m brand new to blogging but
I do write in my journal everyday. I’d like to start a blog so I will be able to share my experience and thoughts online.
Please let me know if you have any kind of suggestions or tips for brand new aspiring bloggers.
Thankyou! scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery
Hi my friend! I want to say that this article is awesome, great written and include approximately all vital infos.
I’d like to peer extra posts like this . quest bars https://www.iherb.com/search?kw=quest%20bars quest bars
gay relationship dating sites
gay dating age is a number
gay dating guide
online paper editor
business plan writing services
writing and editing
help with college essays
https://cialisvet.com/
cialis cost tadalafil generic
Many thanks, this site is very useful. bovada online casino
cialis without a prescription side effects of tadalafil
cost tadalafil generic https://nextadalafil.com/
horseshoe baltimore slots google free slots sunset slots instant play quick hit slots free play
porn slots pit people more slots wobka slots promo codes las vegas slots free
zynga wizard of oz slots scatter slots aol slots lounge super lucky casino slots
wms free online slots vegas online slots double down slots lincoln slots
tadalafil without a doctor prescription cialis without prescription
lipitor 40 mg price comparison
cost tadalafil generic cheapest tadalafil cost
987683 598168I genuinely enjoyed this. It was incredibly educational and useful. I will return to examine on upcoming posts 253641
cheap cialis pills for sale cialis tadalafil
tadalafil generic tadalafil cost walmart
cheapest stromectol online ivermectin tablets from india
price of stromectol absolute accuracy stromectol pills
http://www.ivermectinoge.com/ buy ivermectin online
https://ivermectinetc.com/ stromectol