I have two questions.
① How can if statement adapt to below when the initial value of useState is true and false?
const [ goodbotton, setGoodBotton ] = useState(<Image source={require('../../images/good_botton_inactive.png')} style={ {width: 65, height: 65} }/>);
Like for Example ..
const [ goodbotton, setGoodBotton ] = useState(<Image movie?.is_my_good ? source={require('../../images/good_botton_inactive.png')} style={ {width: 65, height: 65} } : source={require('../../images/not_good_botton_inactive.png')} style={ {width: 65, height: 65} } />);
② How can setGoodBotton from React hooks and if statement adapt to below when the if statement is true and false?
<TouchableOpacity
onPress={() => {
if (movie.is_my_good) {
postGood(movie.id, false)
} else {
postGood(movie.id, true)
}}>
<View style={[commonStyles.shadow]} > {/*here!!!!*/}
</View>
</TouchableOpacity>
Like for Example ..(this is not work)
if (movie.is_my_good) {
setGoodBotton(<View style={[commonStyles.shadow]} >)
} else {
setGoodBotton(<View style={[uncommonStyles.shadow]} >)
}