https://gazero-marvel.netlify.app/
npx create-react-app card-app
npm install react-redux redux
npm install react-router-dom
npm install styled-components
npm start
import { createStore } from "redux";
function reducer(state, action) {
return { contents };
}
export const store = createStore(reducer);
const contents = [
{
path: "/",
imagePath: "",
hoverImagePath: "",
title: "",
detail: {
name: "",
korName: "",
videoSrc: "",
desc: "",
},
},
]
import { Provider } from "react-redux";
import { store } from "./utilities/contents";
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<Provider store={store}>
<App />
</Provider>
</React.StrictMode>
);
import { BrowserRouter, Route, Routes } from "react-router-dom";
<BrowserRouter>
<Routes>
<Route />
<Route />
<Route />
....
<Route />
</Routes>
</BrowserRouter>
<BrowserRouter>
<상단바 />
<Routes>
<Route 카드1 상세페이지 />
<Route 카드2 상세페이지/>
<Route 카드3 상세페이지/>
....
<Route 카드9 상세페이지/>
</Routes>
</BrowserRouter>
<BrowserRouter>
<GlobalStyles />
<상단바>
</상단바>
<Routes>
{useSelector((state) => state.contents).map((content, idx) => {
return (
<Route
path={content.path}
key={idx}
element={<Detail content={content.detail} />}
/>
);
})}
<Route path="/" element={<Cards />} />
</Routes>
</BrowserRouter>
const navigate = useNavigate();
<BackButton onClick={() => navigate(-1)}>BACK</BackButton>
<NavLink to='/path' />
배포했눈데 볼래오? https://gazero-marvel.netlify.app/