question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component not updating

See original GitHub issue

Issue 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:closed
  • Created 9 months ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jquensecommented, Aug 31, 2022

should be fixed in https://github.com/4Catalyzer/found/commit/5c82516d93f93b94d1e16b7bfb216286074ae18d and released as 1.1.2, please test it out

1reaction
jquensecommented, Aug 31, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found