I have a simple application that retrieves data from a Redux store. The store is saved from the api via middleware.
I want to achieve that until the data from the api is loaded, I will show the status Loading ...
Where is the problem please? The console is not reporting me and the loading status is not displayed.
import { useState, useEffect, useTransition } from "react";
import { useSelector } from "react-redux";
const MovieTable = () => {
const { movieDetail } = useSelector(state => state.movieDetail);
const [isPending, startTransition] = useTransition();
const [movie, setMovie] = useState({});
useEffect(() => {
startTransition(() => {
setMovie(movieDetail);
});
}, [movieDetail]);
return (
<div>
{isPending && <p>Loading...</p>}
<div>{movie.Title}</div>
</div>
);
};
export default MovieTable;
Thanks