Currently my component is rendering 4 times. Looks like it is rendering for each prop. If I remove the props except network then it just render 1 time however I do need the other props. I am using a if statement inside the componentDidUpdate because I need to detect change however I am rendering 4 times and my network prop is the same
export class Camera extends Component {
componentDidUpdate(prevProps, prevState){
if (prevProps.network !== this.props.network){
this.connect(this.props.network)
console.log('rendering')
}
}
connect=()=>{
//
}
render() {
return (
<View>
<Text>
Hello World
</Text>
</View>
)
}
}
export default function (props) {
return (
<Camera
navigation={props.navigation}
route={props.route}
network={React.useContext(NetworkContext)}
/>
);
}