Question: Convert the react native code below to flutter code react native code here import React, { Component } from 'react'; import { StyleSheet,Text, View, Button
Convert the react native code below to flutter code
react native code here
import React, { Component } from 'react'; import { StyleSheet,Text, View, Button } from 'react-native'; class App extends Component{ constructor(){ super(); this.state={isLit:false} } toggleLight=()=>{ this.setState({isLit:!this.state.isLit}) } render() { const {isLit}=this.state; return ( ); } } class LightBulb extends Component{ renderText=()=> { if(this.props.isLit===false){ return"OFF"; } if(this.props.isLit===true){ return"ON"; } return ""; } render() { return ( {this.renderText()} ); } } class LightButton extends Component{ constructor(){ super(); this.state={isLit:null} } componentDidMount(){ this.setState({isLit:this.props.isLit}) } renderText=()=> { if(this.state.isLit===false){ return "Turn light on"; } if(this.state.isLit===true){ return "Turn light off"; } return ""; } render () { return ( ); } } const styles =StyleSheet.create({ container:{ flex:1, backgroundColor:'#fff', alignItems:'center', justifyContent:'center', }, green:{ backgroundColor:'green', padding:5, }, red:{ backgroundColor:'red', padding:5, }} ); export default App; Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
