'Why my react native radio button work very slowly when load another component?
Below you can see my react native page code. Here I am going to change content when click the radio button named 'x' and 'y'.
const Signup = () => {
const [type, setType] = React.useState('')
const data = [
{
label: 'x'
},
{
label: 'y'
}
];
const radioHandler = (e) => {
let value = e.label;
if(value==="Orgaization"){
console.log(value)
setType(value)
}
else{
console.log(value)
setType(value)
}
};
return(
<View style={styles.container}>
<RadioButtonRN
style={{padding:0,width: 'auto'}}
data={data}
selectedBtn={(e) => radioHandler(e)}
{type==='x' && x()}
{type==='y' && y()}
</View>
)
const x = ()=>{
return(//Here some components)
const y = ()=>{
return(//Here some components)
This code work without any error. But when I going to load x and y components radio button work very slowly how can I fix this issue.
Solution 1:[1]
Remove all of the console logs
run on real device or cancel other tasks for emulator to run fast
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Raphael |
