React-md Buttons display

Viewed 144

Does anyone know how to create a button using react-md on react js? The purpose of the button is if you click on one of them it turns blue and the other is disabled and turned to grey color. Do you have any similar examples to it or could you point to tutorials regarding it?

1 Answers

You can do like this: 1. Create an onClick event for your button:

handleClick(){
this.setState({isClick: true})
}
  1. On render you can create an object for style:

Const buttonStyle = this.state.isClick? style.active : style.disable;

  1. Create an object style for you button:

    const style = { active: //css here, disable: //css here }

  2. Apply that buttonStyle to the component:

    <Button style={buttonStyle}> </Button>

Related