New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[React.memo] Warning: Failed prop type: Invalid prop component
of type object
supplied to Route
, expected function
#6471
Comments
This is fixed in 4.4. You can use the beta or wait for a final release. |
@timdorr I am curious. How is it actually fixed? I mean the prop types validator is still using |
OK, now this is more interesting. I just migrated our company code from using And I indeed updated Nothing changes... Same error. Did I miss something here? I assume the procedure would be, wait the PR for react-is to be landed, then we update the react-router afterward. |
Found the PR for React-router for bumping the version number, after landing, the issue shall resolved, #6447 |
@vensa-albertgao I wouldn't be so sure about that. There is still pending PR for |
@FredyC haha, yes, exactly. Forgot that, yes, even this PR lands, we need the actual fix land on react-is. But wait, how could this react router PR knows which version to bump... If react-is has not been fixed, the final version number is not there, yet, right...? |
From what I can tell, the bump in #6447 will fix this issue for memo. The PR linked to by @FredyC is for At least, from what I'm seeing. I could be wrong, but that's my interpretation of things. |
I have removed node_module as advised #6447 (comment) but no changes |
#6447 was merged but hasn't been released yet, so you'll still get that error until there's a new release |
@frehner Hi, when will be there the new release? |
@seifsg not sure, I’m not someone who can make a new one so you’ll have to ask those in charge |
Keen to get a new release also, how can we help? |
No new release since four months. |
Try using <Route render ={()=> < Test />} path="path" /> rather than using the component prop. |
@stack-wuh what have you actually done to resolve it a screenshot isnt really much help |
Not sure if it's relevant. But in my case I'm using react hooks with router. So in order to get rid of this message I used this code: import React, { useEffect, lazy } from 'react' const OrderRoute = () => {
} export default OrderRoute; basically adding withRouter removes the message |
Good idea, but you should not use a HOC inside the render function. I can confirm that this workaround works for 4.3: import React, { lazy, Suspense } from "react";
import { Route, withRouter } from "react-router-dom";
const LazyComponent = withRouter(lazy(() => import("./YourComponent")));
export function App() {
return (
<Suspense fallback={<div>loading...</div>}>
<Route component={LazyComponent} />
</Suspense>
);
} |
@PutziSan It feels fairly silly to wrap component into another HOC just because DEV-only prop types check is failing :) What about trying 4.4-beta instead? I had no problem with that so far. |
This issue was fixed on the last version of react-router-dom@5.0.0 |
I've resolved updating |
We still have this issue and we can't upgrade to v5 because it breaks our production build. Is there an alternative to fix this warning? |
As @gpbl mentioned, some of us can't upgrade to v4 / v5. instead of
to do this
|
@sag1v you should use |
Why not |
Hmm, not sure about |
Everytime what, a route change? |
Every time your parent component (where you render |
Sounds silly to say but... in some cases this is not a bug. One of your routes may be pointing to an empty file, throwing this error. |
How to reproduce:
yarn start, rendering works fine!
check the console:
I fired this issue at mobxjs/mobx-react-lite#12 as well.
The text was updated successfully, but these errors were encountered: