UNPKG

redux-first-router

Version:

think of your app in states not routes (and, yes, while keeping the address bar in sync)

17 lines (12 loc) 448 B
// @flow import type { Document } from '../flow-types' export default (doc: Document, title: ?string): ?string => { if (typeof title === 'string' && doc.title !== title) { return (doc.title = title) } return null } export const getDocument = (): Document => { const isSSRTest = process.env.NODE_ENV === 'test' && typeof window !== 'undefined' && window.isSSR return typeof document !== 'undefined' && !isSSRTest ? document : {} }