preact-router
preact-router copied to clipboard
The behavior of Router.onChange() is different between 2.6.1 and 3.0.0
The behavior of Router.onChange() is different between 2.6.1 and 3.0.0.
onChange(event) is Router.onChange() in 2.6.1 and Preact 8.4.2.
When event.url is /foo, this transfers to bar.
But, This does not transfer to bar in 3.0.0 and Preact 10.0.0-alpha.2.
function onChange(event) {
if (event.url === '/foo') {
router('/bar')
}
}
Following code transfers to bar in 3.0.0 and Preact 10.0.0-alpha.2.
function onChange(event) {
if (event.url === '/foo') {
setTimeout(() = {
router('/bar')
})
}
}