score:1

Accepted answer
const [isLoading, setisLoading] = useState(true);
    const [movieNotFound, setmovieNotFound] = useState(false);
  
    return (
        <div>
            {isLoading ? (
                <div class="spinner-grow" role="status">
                    <span class="visually-hidden">Loading...</span>
                </div>
            ) : (
                <>
                    {movieNotFound && <h1>Movie not found</h1>}
                    {!movieNotFound &&
                        <div>
                            <h1>{movie.title}</h1>
                            <h1>{movie.overview}</h1>
                        </div>
                    }
                </>
          )}
      </div>
    );
}

score:0

{ movieNotFound && <h1>Movie not found</h1> }
{ 
  !movieNotFound &&
  <div>
     <h1>{movie.title}</h1>
      <h1>{movie.overview}</h1>
  </div>
}

score:0

const MainPaymentPage =(props)=>{
    const [isNextClicked,setNextClicked]=useState(false);
    let componentCode=<IntroScreen click={()=>setNextClicked(true)}/>
    if(isNextClicked){
        componentCode=<Payment/>
    }
    return(
        {componentCode}
    )
}

export default MainPaymentPage;

score:0

  const [isLoading, setisLoading] = useState(true);
  const [movieNotFound, setmovieNotFound] = useState(false);

  return (
    <div>
      {isLoading ? (
        <div class="spinner-grow" role="status">
          <span class="visually-hidden">Loading...</span>
        </div>
        ) : (
            ()=> {  
                if(movieNotFound === true)
                {<h1>Movie not found</h1>}
                else
          {
            <div>
              <h1>{movie.title}</h1>
              <h1>{movie.overview}</h1>
            </div>
          }

            }
      )
      
      }
    </div>
  );


export default MovieDetails;

score:1

return (
    <div>
      {isLoading ? (
        <div class="spinner-grow" role="status">
          <span class="visually-hidden">Loading...</span>
        </div>
      ) : (
        movieNotFound  ? 
          <h1>Movie not found</h1> : (
            <div>
              <h1>{movie.title}</h1>
              <h1>{movie.overview}</h1>
            </div>
          )

      )}
    </div>
  );

Related Query

More Query from same tag