@couchwarfare/client
v0.1.8
Published
``` javascript import { useOnlineReducer, fetchAccessToken, timestamp } from '@couchwarfare/client'
Downloads
4
Readme
@couchwarfare/client
import { useOnlineReducer, fetchAccessToken, timestamp } from '@couchwarfare/client'
const [accessToken, setAccessToken] = useState()
const gameId = 'RANDOMGAMEID'
const name = 'RANDOMNAME'
useEffect(() => {
fetchAccessToken({ name }).then((v) => setAccessToken(v))
}, [])
const [state, dispatcher, readyState] = useOnlineReducer(reducer, initialArg, init, accessToken, roomId)
// Prints the timestamp. The offset will be set after calling fetchAccessToken.
console.log(timestamp())