I am trying to understand how to structure the front-end of a web application using typescript, preact and preact-router. I have come a long way, but I still need to figure out how to programmatically navigate (redirect) using preact-router. I can do it history.replaceState(null, null, '/#/redirectedUrl');, but while this changes the URL in the address bar, preact-router does not route the new URL.
history.replaceState(null, null, '/#/redirectedUrl');
What is the preferred way to programmatically navigate using preact-router?
Importing a function routefrom 'preact-router'is a way:
route
'preact-router'
import { route } from 'preact-router'; route('/url/to/rout/to');
import { route } from 'preact-router'; route('url');
pushState ( ), URL
import { route } from 'preact-router'; route('url', true);
replaceState ( ), URL URL, . , , home/dashbaord, , ( dashbaord).
Source: https://habr.com/ru/post/1671932/More articles:Swift URL Session and URL Request not working - iosround number instead of decimals - javascriptHow to conditionally use the "flatmap" operator? (Angular 2 / rxjs) - ecmascript-6Use image from shared folder - htmlRxJS / Angular: how to pin observable arrays of objects - angularXamarin C # Error: SecureChannelFailure (Authentication or Decryption Error). - xamarinVS 2017 - Team Explorer Commit - shortcut - gitConditionally select observable in RxJS - javascriptHandle error in RxJs flatMap stream and continue processing - angularMySQL возвращает несколько результатов для одного emoji - mysqlAll Articles