From 22e1f491f01b0a260fedc2be6512df4dce5e7404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9B=90=EB=8D=94?= Date: Wed, 3 Feb 2021 22:39:30 +0900 Subject: [PATCH] feat: added Redirect component --- components/Redirect.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 components/Redirect.tsx diff --git a/components/Redirect.tsx b/components/Redirect.tsx new file mode 100644 index 0000000..fe27fe3 --- /dev/null +++ b/components/Redirect.tsx @@ -0,0 +1,23 @@ +import dynamic from 'next/dynamic' +import { useRouter } from 'next/router' + +import { redirectTo } from '@utils/Tools' + +const Container = dynamic(() => import('@components/Container')) + +const Redirect = ({ to }:RedirectProps):JSX.Element => { + const router = useRouter() + if(!to) throw new Error('No Link') + redirectTo(router, to) + return +
+ 자동으로 리다이렉트되지 않는다면 클릭해세요. +
+
+} + +interface RedirectProps { + to: string +} + +export default Redirect \ No newline at end of file