mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-26 17:02:27 -04:00
* rename * migrate * migrate create language redirect * fix type of redirects * migrate test Co-authored-by: Parth Parth <thecodingaviator@users.noreply.github.com> Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
13 lines
239 B
TypeScript
13 lines
239 B
TypeScript
import { navigate } from 'gatsby';
|
|
|
|
const createRedirect =
|
|
(to = '/'): (() => JSX.Element | null) =>
|
|
() => {
|
|
if (typeof window !== 'undefined') {
|
|
void navigate(to);
|
|
}
|
|
return null;
|
|
};
|
|
|
|
export default createRedirect;
|