score:5

you would conditionally render the entire bit of code and you would would have to return it in parenthesis with a single root element. so for instance

{
  isMobile ? (
    <MyComponent>
      // this code runs if isMobile === true
      // ... code for MyComponent
    </MyComponent>
  ) : (
    <div className={styles.myclassStyle}>
      // this code runs of isMobile === false
      // ... code for the div goes here
    </div>
  )
}

Related Query

More Query from same tag