Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- state = {};
- constructor(props) {
- super(props);
- this.state = {
- price: "00.00"
- };
- }
- componentWillReceiveProps(nextProps) {
- if (this.props.price !== nextProps.price && nextProps.price) {
- this.setState({ price: nextProps.price });
- }
- }
- render() {
- const { disabled } = this.props;
- return (
- <div>
- {!disabled ? (
- <Link className="toggle-cur" to="/trade/btc">
- <CurrencyLink>
- {this.state.price}
- <b>1 BTC</b>
- </CurrencyLink>
- </Link>
- ) : (
- <CurrencyLink>
- {this.state.price}
- <b>1 BTC</b>
- </CurrencyLink>
- )}
- </div>
- );
- }
Add Comment
Please, Sign In to add comment