From 3f57eac29191d341521b16de7bcf8a6967e2c6a2 Mon Sep 17 00:00:00 2001 From: wonderlandpark Date: Thu, 25 Mar 2021 15:53:38 +0900 Subject: [PATCH] chore: made some changes at redirect --- components/Redirect.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/Redirect.tsx b/components/Redirect.tsx index fe27fe3..c82b38d 100644 --- a/components/Redirect.tsx +++ b/components/Redirect.tsx @@ -1,3 +1,4 @@ +import { ReactNode } from 'react' import dynamic from 'next/dynamic' import { useRouter } from 'next/router' @@ -5,10 +6,13 @@ import { redirectTo } from '@utils/Tools' const Container = dynamic(() => import('@components/Container')) -const Redirect = ({ to }:RedirectProps):JSX.Element => { +const Redirect = ({ to, children }:RedirectProps):JSX.Element => { const router = useRouter() if(!to) throw new Error('No Link') redirectTo(router, to) + if(children) return <> + {children} + return
자동으로 리다이렉트되지 않는다면 클릭해세요. @@ -18,6 +22,7 @@ const Redirect = ({ to }:RedirectProps):JSX.Element => { interface RedirectProps { to: string + children?: ReactNode } export default Redirect \ No newline at end of file