Skip to content

Mass setting of wrapping state.

Latest

Choose a tag to compare

@NullVoxPopuli NullVoxPopuli released this 20 Oct 20:48
· 11 commits to master since this release

When using the state wrapper, you can now set the 'initial' state:

@wrapStateHelpers
export default class Example extends Component {
  componentDidMount() {
    this.props.setWrappingState({
      userName: ''
    });
  },

  componentDidReceiveProps(nextProps) {
    this.props.setWrappingState({
       // if you are manually passing render props in and want that to override
       // the internally managed state at nextProps.values.userName
      userName: nextProps.userName
    });
  }
});