I need to change render function and run some sub render function when a specific state given,
For example:
render() {
return (
You can't provide if-else condition in the return block, make use of ternary block, also this.state will be an object, you shouldn't be comparing it with a value, see which state value you want to check, also return returns only one element, make sure to wrap them in a View
render() {
return (
{this.state.page === 'news'? data : null}
)
}