This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext } from 'react' | |
import { animated, useSpring } from 'react-spring' | |
import styled from 'styled-components' | |
import CleanButton from '../elements/clean-button' | |
import useMeasure from '../hooks/measure.hook' | |
import useToggle from '../hooks/toggle.hook' | |
type Props = { | |
header: React.ReactNode | |
children: React.ReactNode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function delayRendering<MyProps>(Component: React.FC<MyProps> | React.ComponentClass<MyProps>, maxDelay = 1000) { | |
// We need to memoize the original component so that it | |
// does not rerender every time the parent rerenders | |
const MemoizedComponent = React.memo(function(props: MyProps) { | |
return <Component {...props} /> | |
}) | |
return (props: MyProps) => { | |
const [previousProps, setPreviousProps] = useState(props) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const app = express(); | |
app.get("/ping", (req, res) => { | |
res.send("pong"); | |
}); | |
app.use(function(req, res, next) { | |
res.status(404).send("Nope"); | |
}); |