Skip to content

Conversation

@cclusetti
Copy link

@cclusetti cclusetti commented Mar 4, 2017

Since form components must be of type:
components: PropTypes.objectOf(PropTypes.instanceOf(Base)),
it helps to expose Base.jsx to be able to compose custom components

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 47df596 on cclusetti:master into e342675 on Lesha-spr:master.

@nemzes
Copy link
Contributor

nemzes commented Mar 9, 2017

You don't need to do this; the component that must extend Base is created automatically by the factory* functions. You only need to extend Base if you want to completely overwrite the components without using the factories — but then you lose all of the functionality of react-validation itself for that component.

@cclusetti
Copy link
Author

I'm looking to use this with the react-select component (https://github.com/JedWatson/react-select) so it'd be easiest for me to create a wrapper component that handles the validation(i.e. registering the component with the form basically) for this react-select.

@nemzes
Copy link
Contributor

nemzes commented Mar 15, 2017

Ah, I see. That looks like a pretty complex component; I assume that simply wrapping it with a selectFactory wouldn't be enough to handle its behaviour (e.g. like here: https://github.com/Lesha-spr/react-validation/blob/master/lib/src/components/Select/Select.jsx)?

In which case, yes, exposing Base makes a lot of sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants