1

I have a <Grid> Component where <Rows>are added dynamically. As shown below

Grid

on click of Add Menu Item I push a <Row> component to the <Grid>

on click of Save I want to access the data inside all the <Row> components so far. I know we can access a single input using refs but is there a way to fetch the grid contents into a single array of objects in React.?

Incpetor
  • 1,293
  • 6
  • 25
  • 46
  • Sometime age I had interview task to build dynamic list with possibility to edit. If you wish you can check it and maybe it will help you with your task : https://github.com/uhlryk/egnyte-test – Krzysztof Sztompka May 20 '16 at 20:37
  • You can refer to my answer in https://stackoverflow.com/questions/36941829/how-to-load-component-dynamically-in-reactjs/46188808#46188808 – Saman Sep 15 '17 at 05:27

1 Answers1

0

Have you tried looping over this.props.children in <Grid>? If <Row> exposes a getter method you should be able to access its content this way.

timotgl
  • 2,865
  • 1
  • 9
  • 19