best practice for ternary in react

PHOTO EMBED

Fri Apr 22 2022 08:28:32 GMT+0000 (Coordinated Universal Time)

Saved by @yasharhabibi

function App() {
  const isMobile = useWindowSize();
    
  const ChatComponent = isMobile ? <MobileChat /> : <Chat />;

  return (
    <main>
      <Header />
      <Sidebar />
      {ChatComponent}
    </main>
  )
}
content_copyCOPY

https://www.freecodecamp.org/news/learn-react-conditionals/