Use parent component to pass initial value to child without relying on state ReactJS

Hey even though you may do this better way if I understood correctly I think you can achieve what you want by just using:


on B Component:

<input defaultValue={this.props.value} onChange={this.onChange}/>

and then when you handle update just pass in to parent (A component)

I’m not 100% sure if that’s what you are asking but here’s example:

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top