Skip to content

Instantly share code, notes, and snippets.

View Jeyloh's full-sized avatar

Jørgen Lybeck Hansen Jeyloh

View GitHub Profile
@Jeyloh
Jeyloh / AnimatedSwitch.jsx
Created April 28, 2021 07:14
React framer-motion route animations
import React from "react";
import { Switch } from "react-router-dom";
import { useSelector } from "react-redux";
import { AnimatePresence, motion } from "framer-motion";
import { getPlatform, isMobilePlatform } from "../util/browser.helper";
import styled from "styled-components";
import { ROUTES } from "constants/routes.const";
// This can be tweaked for speed and opacity on enter-exit animations.
const variants = {