[Solid] 페이지 라우팅 설정하기

2025. 2. 8. 02:46·Frontend/SolidJS

Solid-Meta와 Solid-Router를 사용합니다.

App.tsx

import Pages from './pages';

const App: Component = () => {
  return (
    <MetaProvider>
    <Router>
      <Route>
        <Pages/>
      </Route>
    </Router>
    </MetaProvider>
  );
};

/Pages/index.tsx

const Pages = () => {
  return (
    <>
        <Route path="/" component={MainPage} />
        <Route path="/path1" component={path1Page} />
        <Route path="/path2" component={path2Page} />
        {/* ... */}
    </>
  )
}

export default Pages

index.tsx 파일이 있다면 다른 곳에서 Pages 폴더만 호출해도 index.tsx가 기본 파일로 호출되기 때문에,

 

Pages 컴포넌트를 불러올 수 있습니다.

728x90

'Frontend > SolidJS' 카테고리의 다른 글

[Solid] Solid-Router: 페이지 라우팅 설정하기  (0) 2025.02.08
[Solid] Solid-Meta: 메타데이터 다루기  (0) 2025.02.08
[Solid] Syntax | 13. Resource  (0) 2025.01.31
[Solid] Solid Start에 대해서  (0) 2024.07.09
[Solid][CSS] SolidJS에서 macaron 사용하기  (0) 2024.07.01
'Frontend/SolidJS' 카테고리의 다른 글
  • [Solid] Solid-Router: 페이지 라우팅 설정하기
  • [Solid] Solid-Meta: 메타데이터 다루기
  • [Solid] Syntax | 13. Resource
  • [Solid] Solid Start에 대해서
Rayi
Rayi
  • Rayi
    아카이브
    Rayi
  • 전체
    오늘
    어제
    • 분류 전체보기 (276)
      • CS (40)
        • CV (2)
        • PS (34)
      • Reveiw (18)
        • Paper (18)
        • Github (0)
      • ML (8)
        • Pytorch (5)
      • Language (59)
        • Python (8)
        • JavaScript (32)
        • TypeScript (16)
        • C++ (3)
      • IDE (12)
      • Git (13)
      • Frontend (77)
        • React (8)
        • ReactNative (6)
        • SolidJS (20)
        • CSS (12)
      • Backend (44)
        • DB (18)
        • Node.js (11)
      • UI (3)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    deploy
    modal
    python
    CSS
    backend
    vscode
    Git
    nodejs
    js
    mongo
    SOLID
    PRISMA
    ML
    CS
    Three
    expo
    postgresql
    CV
    ReactNative
    ps
    Express
    react
    figma
    review
    ts
    GAN
    API
    PyTorch
    DB
    frontend
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
Rayi
[Solid] 페이지 라우팅 설정하기
상단으로

티스토리툴바