user image

Joseph Morgan
Published in : 2021-11-29

[solved] Expected a conditional expression and instead saw an assignment

React js

Reactjs Expected a conditional expression and instead saw an assignment, i can see this warning in the console of my project how can I remove it? the function which cause this error is 

    async deleteCompany(id){
        try{
            let res = await axios.delete(BackendURL+'/save/'+id+'/');
            if(res.status = 200){
                this.props.reload();
            }
        }catch(err){
            console.error(err);
        }
    }

what should I do? 

— Update — 

I found the issue. it's because inside the condition there is one “=”  it supposed to be at least two “==” or three “===”
 

web-brackets.com

Comments

There is no comments yet

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Best way to update the state in one class component from the redux store?
Publish date: 2022-03-30 | Comments: 3

Tag: React js

How to use Datepick of Mui with Formik
Publish date: 2022-02-14 | Comments: 6

Tag: React js

[solved] useEffect is repeating the request Reactjs
Publish date: 2022-04-07 | Comments: 2

Tag: React js

How to update React router without Re-render?
Publish date: 2021-11-22 | Comments: 2

Tag: React js

Warning: React.jsx: type is invalid
Publish date: 2022-05-06 | Comments: 1

Tag: React js

React Component setState doesn't update my property
Publish date: 2022-03-29 | Comments: 2

Tag: React js