First I try to check if the user's id is matching with the one from DB. If so then set a new state for hasApplied and toggle but I receive the following waring Cannot update during an existing state transition (such as within 'render' or another component)... 
I've tried even to call a function thats outside render and is saying the same thing. But if I call that function outside render by onPress={} method from a button component then everything is fine. But in this case I need to check this first when the user access the page and if hasApplied return false then use the button 
render() {
        let { hasApplied } = this.state;
        let { toggle } = this.state;
        let matchUserId = [];
        const textValue = toggle ? 'APPLIED' : 'APPLY NOW';
        const buttonBg = toggle ? '#848d95' : '#34ed1c';
        const buttonState = toggle ? 'false' : 'true';
        const { navigation } = this.props;
        const { goBack } = this.props.navigation;
        const { jobBusiness, locationBusiness } = this.props.navigation.state.params;
        let { user, location, job, data, business } = this.props.navigation.state.params;
        // Check the available applied ids and concatenate objects in Array
        // Check if user_id match any of appliedUserId 
        if (!hasApplied) {
            job.applied.map(o => {
                matchUserId.push(o.user_id);
            });
            const resultUserId = [].concat.apply([], matchUserId);
            hasApplied = resultUserId.includes(this.props.user_id)
            // this.onButtonPress()
            this.setState({hasApplied: true, toggle: true})
        }
Can anyone have a solution for this?
thanks
 
    