React Native App Development Company in USA | Page 6

Export default class App extends Component { constructor(props){ super(props); This.state = {isOn : false}; this.updateStatus(); } turnOn =() => { NativeModules.Bulb.turnOn(); this.updateStatus(); updateStatus = () => { NativeModules.Bulb.getstatus((error,isOn ) => { this.setState({ isOn : isOn)}; )} } render(){ return( Welcome to Light App !! Bulb is {this.state.isOn ? “ON” : “OFF”} {!this.state.isOn ? “Turn ON” : ”Turn OFF” } ); } } COPY