Guest User

Untitled

a guest
Mar 21st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. import React, { Component } from 'react'
  2.  
  3. class MyComponent extends Component {
  4. constructor(props){
  5. super(props);
  6. this.state = {
  7. someValue: props.someValue,
  8. };
  9. }
  10.  
  11. componentWillReceiveProps(nextProps){
  12. if (nextProps.inputValue !== this.props.inputValue) {
  13. this.setState({ inputVal: nextProps.inputValue })
  14. }
  15. }
  16. }
Add Comment
Please, Sign In to add comment