Hacker News new | past | comments | ask | show | jobs | submit login

It looks like this could make use of React's context feature once #2112 [1] lands.

I have similarish form components [2] which need to do this the hacky way in the meantime (cloning [3] their children in order to pass the form prop they need all the way down):

    <forms.RenderForm form={ProductForm} initial={this.props.product} ref="productForm">
      <Container>
        <Row>
          <Field name="productName" md="8"/>
          <Field name="tags" md="4"/>
        </Row>
        ...

[1] https://github.com/facebook/react/issues/2112

[2] https://github.com/insin/newforms-bootstrap

[3] http://facebook.github.io/react/docs/clone-with-props.html




So are you traversing the entire tree of children here? I'm familiar with cloneWithProps, but I've been wary about this technique because of how deep the components I actually want to bind could be and how much traversal it could take to find them.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: