Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Problem with Refs #732

Closed
joinjoohny opened this issue Apr 2, 2017 · 2 comments
Closed

Problem with Refs #732

joinjoohny opened this issue Apr 2, 2017 · 2 comments
Labels

Comments

@joinjoohny
Copy link

I have problem with React.Children
I am doing React.Children.map(children) for this elements
Why refs from Control.text is null? Thank you for any help!

     // react-card-input-checkout.cardnumber : null
    <Control.text
      model="checkout.cardnumber"
      type="text"
      placeholder="Card number"
      name="checkout.cardnumber"
    />
    // react-card-input-CCexpiry : input
    <input placeholder="MM/YY" type="text" name="CCexpiry" />
     // react-card-input-CCcvc: input
    <input placeholder="CVC" type="text" name="CCcvc" />

Result

refs:
Object
react-card-input-CCcvc: input
react-card-input-CCexpiry : input
react-card-input-checkout.cardnumber : null
@davidkpiano
Copy link
Owner

I don't see in the code you showed me where you are logging the refs. In any case, you will need to use the prop getRef={(node) => ...} on <Control.text in order to get the ref.

See here for why: reduxjs/react-redux#270 (comment)

@davidkpiano
Copy link
Owner

Hopefully your question is answered! getRef is also documented here: http://davidkpiano.github.io/react-redux-form/docs/api/Control.html

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants