Guest User

Untitled

a guest
Dec 13th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. state = {};
  2. constructor(props) {
  3. super(props);
  4. this.state = {
  5. price: "00.00"
  6. };
  7. }
  8. componentWillReceiveProps(nextProps) {
  9. if (this.props.price !== nextProps.price && nextProps.price) {
  10. this.setState({ price: nextProps.price });
  11. }
  12. }
  13. render() {
  14. const { disabled } = this.props;
  15. return (
  16. <div>
  17. {!disabled ? (
  18. <Link className="toggle-cur" to="/trade/btc">
  19. <CurrencyLink>
  20. {this.state.price}
  21. <b>1 BTC</b>
  22. </CurrencyLink>
  23. </Link>
  24. ) : (
  25. <CurrencyLink>
  26. {this.state.price}
  27. <b>1 BTC</b>
  28. </CurrencyLink>
  29. )}
  30. </div>
  31. );
  32. }
Add Comment
Please, Sign In to add comment