Sign in
Log inSign up

React: Multiple or ( || ) operator rendering not working.

Mrudang Shah's photo
Mrudang Shah
·May 10, 2019

I need to render my components with conditional rendering. I am applying a or ( || ) operator for applying a condition. But the condition is not working anyhow.

{ pathName !== '/login' || pathName !== '/signup' || pathName !== '/account' &&
     <Footer />
}

I have also wrap the conditions in the round brackets but then also it is not working.

{ [(pathName !== '/login') || (pathName !== '/signup') || (pathName !== '/account')] &&
     <Footer />
}

Please let me know what i am doing wrong. ?

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct