# All files / src/chap08 routesHandle.js

0% Statements 0/1
100% Branches 0/0
100% Functions 0/0
0% Lines 0/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24

     import { Route, createBrowserRouter, createRoutesFromElements } from 'react-router-dom';
    import TopPage from './TopPage';
    import BookPage from './BookPage';
    import RouterParam from './RouterParam';

    // handle 속성으로 메타 정보 정의
    const routesHandle = createBrowserRouter(
      createRoutesFromElements(
        <Route element={<RouterParam />}>
          <Route path="/" element={<TopPage />} handle={{
            title: '홈',
            keywords: '리액트, 라우터, 자바스크립트',
            description: '리액트 라우터에 대한 설명 샘플입니다.'
          }} />
          <Route path="/book/:isbn?" element={<BookPage />} handle={{
            title: '도서상세 - %s',
            keywords: '리액트, %s',
            description: '%s'
          }} />
        </Route>
      )
    );

    export default routesHandle;