Skip to content

[BAZ] 같이 바다보러갈래? 구현#16

Open
kand193 wants to merge 25 commits intoweek4from
week4-baz
Open

[BAZ] 같이 바다보러갈래? 구현#16
kand193 wants to merge 25 commits intoweek4from
week4-baz

Conversation

@kand193
Copy link

@kand193 kand193 commented Feb 18, 2021

힐링에 맞춰서 전국 해수욕장을 찾은 뒤 가장 가고 싶은 해수욕장을 고르는 이상형 월드컵입니다~
이 결과를 바탕으로 다른 사람과 내가 같은 곳에 가고싶은지 알수도 있게 하려고 했어요!

Copy link
Member

@joi0104 joi0104 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드가 너무 깔끔하네여... 그리고 서비스 제목이 취향저격입니다 ㅎㅎㅎ

import styled from 'styled-components';
import OceanBackground from 'components/index/OceanBackground';
import qs from 'qs';
const IndexPage = ({location}) => {
Copy link
Member

@joi0104 joi0104 Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useHistory 처럼 useLocation 훅을 사용하면 prop로 받을 필요가 없을 것 같아요!

Comment on lines +15 to +17
<Route exact path="/game" component={GamePage} />
<Route exact path="/result" component={ResultPage} />
<Route path="/" component={IndexPage} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분을 좀 흥미로웠는데요! 제가 로직을 잘 이해못해서 그런지 모르겠지만. 저는 보통 path="/"exact 를 걸어두는데, 이 코드에서는 path="/" 제외한 곳에 exact 가 걸려있더라구요! 근데 이러면 일일이 Route 가 생성될때마다 exact 를 걸어주거나 하는등 유지보수 측면에서 안좋아 보이는데, exact 옵션을 저렇게 주신 이유가 있을까요?

Copy link
Collaborator

@danivelop danivelop Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 이렇게 써본적은 없는데 이렇게 '/'에 exact를 안넣고 마지막에 위치시키면 약간 404페이지 느낌으로 아무 route에나 접근해도 IndexPage띄울순 있겠군요! 가끔씩 404페이지 따로 없을때 이렇게 써봐야겠네요ㅎㅎ

Comment on lines +36 to +37
<IndexStateContext.Provider value={state}>
<IndexDispatchContext.Provider value={dispatch}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 저는 보통 하나의 context에 state와 dispatch를 묶어서 보냈는데 이렇게 분리시키는것도 좋아보이네요

type FlagType = 'initial' | 'correct' | 'incorrect';

const ResultPage = ({ location: { state } }) => {
const [ocean] = useState<OceanInfo>(state.ocean);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useState는 해당 컴포넌트에서 값이 변경되는지를 계속 검사하기 때문에 변경되지 않는값이면 useRef가 더 적합할것 같아요!

const name = '민수르';
const messages = {
initial: `"${ocean.name}"에 같이 가고 싶은 사람에게 링크를 공유하세요!`,
correct: `바다 좀 볼 줄 아는군? ${name}와 함께 "${ocean.name}" 보러 가자구~`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ민수르월드

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants