mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-21 14:47:41 +01:00
32 lines
526 B
JavaScript
32 lines
526 B
JavaScript
|
import './index.css';
|
||
|
import { SearchView } from './views/Search';
|
||
|
import { NotFound } from './views/NotFound';
|
||
|
import { MovieView } from './views/Movie';
|
||
|
import { useMovie, MovieProvider} from './hooks/useMovie';
|
||
|
|
||
|
function Router() {
|
||
|
const { page } = useMovie();
|
||
|
|
||
|
if (page === "search") {
|
||
|
return <SearchView/>
|
||
|
}
|
||
|
|
||
|
if (page === "movie") {
|
||
|
return <MovieView/>
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<NotFound/>
|
||
|
)
|
||
|
}
|
||
|
|
||
|
function App() {
|
||
|
return (
|
||
|
<MovieProvider>
|
||
|
<Router/>
|
||
|
</MovieProvider>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
export default App;
|