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

Default Value for Input elements #1379

Closed
lafka opened this issue Oct 4, 2015 · 1 comment
Closed

Default Value for Input elements #1379

lafka opened this issue Oct 4, 2015 · 1 comment

Comments

@lafka
Copy link

lafka commented Oct 4, 2015

Using defaultValue as described in React docs does not work. InputBase passes this.props so defaultValue is set on the new <input /> element - it just doesn't have an effect.

I'm using react-lensed-state with bootstrap:

<Input
  type="text"
  defaultValue={this.state.user.name}
  valueLink={this.linkState('patch.name')}
  bsStyle={this.nameValidationState()[0]}
  help={this.nameValidationState()[1] || ' '}
  label="Name"
  placeholder="Full name"
  />

I can definitely work around this but having a native solution (like React's defaultValue) would be the best.

@lafka
Copy link
Author

lafka commented Oct 4, 2015

Issue on my part.... defaultValue does indeed work but only for initial load (my case this.state.user.name was loaded from remote API so it had no effect)

See http://stackoverflow.com/questions/30146105/react-input-defaultvalue-doesnt-update-with-state

@lafka lafka closed this as completed Oct 4, 2015
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

No branches or pull requests

1 participant