morty
39 строк · 1002.0 Байт
1import React, { useState } from "react";2import { BrowserRouter as Router, Route, Routes } from "react-router-dom";3import Filter from "../filter/Filter";4import CardList from "../characterPage/CharecterPage";5import CardDetalis from "../cardDetalis/CardDetalis";6import "../style/style.scss";7
8function App() {9const [filters, setFilters] = useState({10status: "",11species: "",12gender: "",13});14
15const handleFilterChange = (newFilters) => {16setFilters(newFilters);17};18
19const [showFilter, setShowFilter] = useState(true);20
21return (22<Router>23<div className="App">24{showFilter && <Filter onFilterChange={handleFilterChange} />}25<main>26<Routes>27<Route path="/" element={<CardList filters={filters} />} />28<Route29path="/card/:id"30element={<CardDetalis setShowFilter={setShowFilter} />}31/>32</Routes>33</main>34</div>35</Router>36);37}
38
39export default App;40