Closed shai32 closed 5 years ago
can you share how you use RoutedAnchor? From what i understand from the documentation It seems you need to wrap it withRouter?
I didn't wrap it with withRouter, but I didn't have to in react-router v3.3 If we need to warp it with withRouter, its not really usable
can you probably set up a codesandbox reproducing the problem?
@oorestisime wrapping it with withRouter, doesn't fix the problem.
would you be able to share a codesandbox with the problem or a repo? i don't have any projects with react-router (personally using router5) so it will be much easier to debug.
@oorestisime of course, here is the codesandbox: https://codesandbox.io/s/930z3kjx8y
So i as i understand from their changelog they don't allow any more the this.context.router
.
I updated the codesandbox https://codesandbox.io/s/l5ov5y4269 to show what they expect. You need to wrap components withRouter so you get access to the history, location and match props.
As i see it RoutedAnchor is router agnostic right now so i am not sure it makes any sense form grommet to wrap it internally in the library (it will need to depend on react-router-dom). Plus this is a fairly undocumented component.
Maybe @ericsoderberghp can shred some light on how this is supposed to work.
Since we will be deprecating RoutedButton and RoutedAnchor, we won't be attempting to address this issue. (see #2855)
Expected Behavior
should support react-router 4.4.0 version
Actual Behavior
RoutedAnchor not working with "react-router-dom" version 4.4.0 using it, will print an error on console Failed context type: The context
router
is marked as required inRoutedAnchor
, but its value isundefined
URL, screen shot, or Codepen exhibiting the issue
look at react route changelog https://github.com/ReactTraining/react-router/releases/tag/v4.4.0-beta.0
Steps to Reproduce
Your Environment