Closed sijo-vijayan closed 9 years ago
This might not be the canonical response, but the library react-mixin
works for me.
I use it without the decorators mode as I believe that is too cutting edge and I worry that the implementation might change in future.
I think the benefit to using a library is that you have something which can easily be removed if better support arrives in react
or react-validation-mixin
.
@sebinsua Let me try this library. I have one more doubt, Where should I place the code given below in my react component class ? There is any syntax changes ?
displayName: 'Signup',
mixins: [ValidationMixin, React.addons.LinkedStateMixin],
validatorTypes: {
firstName: Joi.string().required().label('First Name'),
lastName: Joi.string().allow(null).label('Last Name'),
email: Joi.string().email().label('Email Address'),
username: Joi.string().alphanum().min(3).max(30).required().label('Username'),
password: Joi.string().regex(/[a-zA-Z0-9]{3,30}/).label('Password'),
verifyPassword: Joi.any().valid(Joi.ref('password')).required().label('Password Confirmation')
},
getInitialState: function() {
return {
firstName: null,
lastName: null,
email: null,
username: null,
password: null,
verifyPassword: null,
feedback: null
};
},
@sijo-vijayan - I've been waiting till I hit a next major release to enhance this library for ES6/7 support. I'll see if I can provide a simple top level API that you can use in the interim.
@jurassix Thank you for your kind reply. :)
ES6 (and ES7) are first class citizens now.
Hi, I am a newcomer in ReactJs, I would like to use
react-validation-mixin
in my project. But i don't know how to use it with ES6 standard. Can you update the README.md with ES6. This will be very helpful for people like me. Your help will be highly appreciated.Thanks Sijo