Component not updating
See original GitHub issueIssue Description
This is my router:
import { createBrowserRouter, Link, makeRouteConfig, Route } from 'found';
export const Router = createBrowserRouter({
routeConfig: makeRouteConfig(
<Route path='/'>
<Route
path='/a'
Component={() => <div>You are on A. Go to <Link to='/b'>B</Link></div>}
/>
<Route
path='/b'
Component={() => <div>You are on B. Go to <Link to='/a'>A</Link></div>}
/>
</Route>
)
})
And I am rendering it to the DOM like this:
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<Router/>
</React.StrictMode>
);
I start using the application on the /a
path which displays fine. I then click the link which changes the link in the browser’s address bar but does not render the other component. What am I doing wrong? Does this have something to do with React 18? I saw there is an issue open right now regarding React 18 but that was resolved “by miracle” and I am not able to resolve it.
Should I try downgrading React?
These are the versions I am using:
"react-dom": "^18.0.0",
"react": "^18.0.0",
"found": "^1.1.1",
Issue Analytics
- State:
- Created a year ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Why is my react component not updating with state updates?
React ES6 classes do not autobind this by default to non-react base member methods. Therefore, the context for this in your function makeMapEvents...
Read more >Why React doesn't update state immediately
The updater functions enqueue changes to the component state, but React may delay the changes, updating several components in a single pass.
Read more >Component instance is not updating, after the master ...
I have a master component in an external component file. This master component is build out of other subcomponents. If I place this...
Read more >Why isn't my React component updating (using Redux)?
When Redux cannot see that the state has changed, it will not update the React components with new data from the state. How...
Read more >Linked component not updating in Fusion 360
Open the Linked Child Component's original file. · Go to the Modify Menu. · Select Compute All. · Save the Child Component file....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
should be fixed in https://github.com/4Catalyzer/found/commit/5c82516d93f93b94d1e16b7bfb216286074ae18d and released as 1.1.2, please test it out
I have been nerd sniped into working on this today, and so far what I gather is that most of the issues are due react 18 strict mode double mounting components, and side effects in lifecycles. Hoping its pretty easy to fix