Chap05 -> Using route parameters -> Adding the question page route (Finished)
parent
b18e0588b5
commit
8e13f18a03
|
@ -1,8 +1,9 @@
|
|||
/** @jsxImportSource @emotion/react */
|
||||
import { css } from '@emotion/react';
|
||||
import { gray2, gray3 } from './Styles';
|
||||
|
||||
import { Link } from 'react-router-dom';
|
||||
import React from 'react';
|
||||
|
||||
import { gray2, gray3 } from './Styles';
|
||||
import { QuestionData } from './QuestionsData';
|
||||
|
||||
interface Props {
|
||||
|
@ -17,8 +18,16 @@ export const Question = ({ data, showContent }: Props) => (
|
|||
padding: 10px 0px;
|
||||
font-size: 19px;
|
||||
`}
|
||||
>
|
||||
<Link
|
||||
css={css`
|
||||
text-decoration: none;
|
||||
color: ${gray2};
|
||||
`}
|
||||
to={`/questions/${data.questionId}`}
|
||||
>
|
||||
{data.title}
|
||||
</Link>
|
||||
</div>
|
||||
{showContent && (
|
||||
<div
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
import React from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
||||
import { Page } from './Page';
|
||||
|
||||
export const QuestionPage = () => <Page>Question Page</Page>;
|
||||
export const QuestionPage = () => {
|
||||
const { questionId } = useParams();
|
||||
return <Page>Question Page {questionId}</Page>;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue