xref: /expo/docs/components/plugins/Redirect.tsx (revision 4c360b75)
1import { css } from '@emotion/core';
2import * as React from 'react';
3
4const CONTAINER_STYLE = css`
5  background-color: rgba(225, 228, 23, 0.1);
6  padding: 20px;
7  margin-bottom: 20px;
8`;
9
10const Redirect: React.FC<{ path: string }> = ({ path }) => {
11  React.useEffect(() => {
12    setTimeout(() => {
13      window.location.href = path;
14    }, 0);
15  });
16
17  return (
18    <div css={CONTAINER_STYLE}>
19      Redirecting to <a href={path}>{path}</a>
20    </div>
21  );
22};
23
24export default Redirect;
25