reach-router

Reach router navigate updates URL but not component

拥有回忆 提交于 2020-02-24 04:42:53
问题 I'm trying to get Reach Router to navigate programmatically from one of my components. The URL is updated as expected however the route is not rendered and if I look at the React developer tools I can see the original component is listed as being displayed. If I refresh the page once at the new URL then it renders correctly. How can I get it to render the new route? A simplified example is shown below and I'm using @reach/router@1.2.1 (it may also be salient that I'm using Redux). import

Gatsby server-side rendering of page with client-only routes, based on window location

冷暖自知 提交于 2020-01-25 06:49:28
问题 I am working on a Gatsby project (a language learning blog) and am having trouble with an issue that only happens in production builds due to server-side rendering. I programmatically generate a page for each blog post with the following scheme: /posts/{post-name} . Each post can also have a number of subpaths that map to open tabs in the UI. For example, /posts/important-spanish-verbs/lesson would open the lesson tab. Each page has a matchPath property of /posts/{post-name}/* , and these are

Stop Reach Router scrolling down the page after navigating to new page

那年仲夏 提交于 2020-01-02 01:32:31
问题 When I navigate to a new page, Reach Router scrolls down to the page content past the header (if the content is long enough). I'm assuming this is for accessibility but it's not necessary for my app and it's actually quite jarring. Can this behaviour be disabled? Note that I'm talking about Reach Router not React Router. Reach Router 回答1: Try using <Router primary={false}> which will not focus on the route component. https://reach.tech/router/api/Router primary: bool Defaults to true. Primary

Stop Reach Router scrolling down the page after navigating to new page

余生长醉 提交于 2019-12-05 01:44:10
When I navigate to a new page, Reach Router scrolls down to the page content past the header (if the content is long enough). I'm assuming this is for accessibility but it's not necessary for my app and it's actually quite jarring. Can this behaviour be disabled? Note that I'm talking about Reach Router not React Router. Reach Router Try using <Router primary={false}> which will not focus on the route component. https://reach.tech/router/api/Router primary: bool Defaults to true. Primary Routers will manage focus on location transitions. If false, focus will not be managed. This is useful for