This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command
$ docker-compose up -d
# To Tear Down
$ docker-compose down --volumes
// If the user has been on the page for over 12 hours, the next link | |
// click will do a full page transition to get new code | |
import React from "react"; | |
import { BrowserRouter, useLocation } from "react-router-dom"; | |
let hour = 3600000; | |
export default function StaleAppRouter(props) { | |
let [isStale, setIsStale] = useState(false); |
last update: Dec 4, 2020
import React from "react"; | |
import { | |
SafeAreaView, | |
ScrollView, | |
View, | |
Image, | |
StyleSheet, | |
Text, | |
useWindowDimensions, | |
ImageSourcePropType, |
Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.
You use Next.js router like normally, but don't define getStaticProps
and such. Instead you do client-only fetching with swr
, react-query
, or similar methods.
You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)
Don't like Next? Here's how to do the same in Gatsby.
import axios from 'axios' | |
import { useOptimisticMutation } from "./useOptimisticMutation.ts" | |
type Response = boolean | |
type Error = unknown | |
type MutationVariables = {itemId: string} | |
type Items = {id: string; name: string}[] | |
type Likes = {itemId: string}[] | |
type History = {type: string}[] |