Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react'
- class MyComponent extends Component {
- constructor(props){
- super(props);
- this.state = {
- someValue: props.someValue,
- };
- }
- componentWillReceiveProps(nextProps){
- if (nextProps.inputValue !== this.props.inputValue) {
- this.setState({ inputVal: nextProps.inputValue })
- }
- }
- }
Add Comment
Please, Sign In to add comment