Skip to content

Instantly share code, notes, and snippets.

View tim-field's full-sized avatar
💭
🤙

Tim Field tim-field

💭
🤙
  • Dunedin New Zealand
View GitHub Profile
@tim-field
tim-field / SketchSystems.spec
Last active July 17, 2018 04:27
Events Workflow
Events Workflow
Event Type
legal -> Legal
accounting -> Accounting
entity -> Entity
Legal
commencement -> Commencement
term and options -> Term and Options
Commencement
commencement -> Date
@tim-field
tim-field / useRouter.js
Last active June 23, 2023 01:20
Hooks Router
import { useEffect, useState } from "react"
import { createBrowserHistory } from "history"
const history = createBrowserHistory()
const toLocation = path => new URL(path, window.location.href)
// without this react won't re-render as location is the same object
// @see https://reactjs.org/docs/hooks-reference.html#bailing-out-of-a-state-update
const cloneLocation = () => Object.assign({}, window.location)