user

Mohamed Atef

30 Oct 2021

Unexpected mix of '&&' and '||' Reactjs

React js

if you can see this warning in your project console you can figure it out by sorting your condition in (  ), so if your code looks like

!this.state.pagesArray.includes(lastPage-1) && lastPage !== 0 || !this.state.pagesArray.includes(lastPage) && lastPage !== 0?

you will need to add (  ) for the first condition then (  ) for the last condition so the code will be 

(!this.state.pagesArray.includes(lastPage-1) && lastPage !== 0) || (!this.state.pagesArray.includes(lastPage) && lastPage !== 0)?

That's all, I found this issue & I wanted to share it with other developers :)
Thanks

Comments

No Comments to show

© 2024 Copyrights reserved for web-brackets.com