I am new to React and I am trying to create a "CV-Generator" like this like this, What happens here is whenever user puts a value in any of the input it automatically renders to the Render preview(right side),
My problem here is I am rendering a <Form />
where it renders three child components namely:-
<PersonalInfo />
, <Experience />
, <Education />
, In each of three I process Input onChange and setState
the data, but problem is I need to render this data to again Render Preview(right on the link), But I am confused how can I pass my data from child components(i.e. <PersonalInfo />
, <Experience />
, <Education />
) to the parent Component(<App />
)
App.js
return (
<div className='container'>
<Form /> //need data from her childs
<DisplayInfo /> //want to pass data to this one
</div>
);
Form.js
return (
<form>
<PersonalInfo /> //need data from here
<Experience /> //need data from here
<Education /> //need data from here
</form>
);
Example state
from one of the three child
this.state = {
firstName: '',
lastName: '',
title: '',
address: '',
phoneNumber: '',
email: '',
description: '',
};
// want to pass all this data