Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passe empty string to <input> when date is null #3

Merged
merged 1 commit into from
Jan 11, 2017

Conversation

ruianderson
Copy link

This will avoid an error when trying to pass null to value:

Warning: `value` prop on `input` should not be null. Consider using the empty string to clear the component or `undefined` for uncontrolled components.

@@ -95,24 +95,12 @@ var DateInput = React.createClass({
},

render () {
const {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruianderson Wouldn't removing this hunk cause other warnings for unknown props?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had troubles to build the code locally and I had to remove this piece of code. I can revert if it's needed.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be best I think, this was added to get rid of other warnings.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I removed the code and let only the value changes.

This will avoid an error when trying to pass null to <input> value
@firedev firedev merged commit a037615 into firedev:master Jan 11, 2017
return <input
ref='input'
type='text'
{...inputProps}
value={this.state.maybeDate}
value
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was incorrect. I've fixed it.

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.

2 participants