@whatsup/browser-pathname
v0.5.2
Published
Browser pathname computed atom and historyPushState method
Downloads
8
Readme
Browser pathname cause stream
Install
npm i @whatsup/browser-pathname
# or
yarn add @whatsup/browser-pathname
Usage
import { fractal } from 'whatsup'
import { render } from '@whatsup/jsx'
import { pathname, redirect } from '@whatsup/browser-pathname'
const app = fractal(function* () {
while (true) {
switch (yield* pathname) {
case '/':
yield <a onClick={() => redirect('/test')}>Go to test page</a>
continue
case '/test':
yield <a onClick={() => redirect('/')}>Go to home page</a>
continue
}
}
})
render(app)