You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.
I don't understand why this would even bomb out, I'm simply trying to import the A (link) component to my test.
I'm not even exercising this yet in code, why does it ask for location? If It needs it for tests, how do I provide that?
import{A}from'hookrouter';it('image links to their profile page',()=>{
...
constimage=isolateComponent(<GravatarImageuser={user}/>)...expect(profileLink.props.href).to.equal(routeToProfile);});
Error:
node_modules/hookrouter/src/queryParams.js:55
queryParamObject = queryStringToObject(location.search.substr(1));
^
ReferenceError: location is not defined
at Object.<anonymous> (/node_modules/hookrouter/src/queryParams.js:55:41)
It's not even my test, I get this same exact problem when I import this into production code, what gives? The docs don't even talk about location.
Here's what I'm trying to do in the corresponding child component:
So when I click it, it should navigate to that route and render the Company Profile page.
Here's my App.tsx:
exportconstroutes={'/company/:id': ({ id })=><CompanyProfilecompanyId={id}/>};constRenderRoute=()=>{constrouteResult=useRoutes(routes);return(<>{routeResult}</>);};constApp=()=><RenderRoute/>exportdefaultApp;
All your examples show the Root App component but no examples show child components. I don't see a need to have routeResult in a child component when if they click a link, it should do a redirect completely out of the current rendered component they are currently in. So how do we get this error resolved and this redirect working here?
The text was updated successfully, but these errors were encountered:
dschinkel
changed the title
Test Errors with location is not defined when importing A
"location is not defined" Error after importing A
Oct 11, 2020
I don't understand why this would even bomb out, I'm simply trying to import the
A
(link) component to my test.I'm not even exercising this yet in code, why does it ask for location? If It needs it for tests, how do I provide that?
Error:
It's not even my test, I get this same exact problem when I import this into production code, what gives? The docs don't even talk about location.
Here's what I'm trying to do in the corresponding child component:
So when I click it, it should navigate to that route and render the Company Profile page.
Here's my App.tsx:
All your examples show the Root App component but no examples show child components. I don't see a need to have
routeResult
in a child component when if they click a link, it should do a redirect completely out of the current rendered component they are currently in. So how do we get this error resolved and this redirect working here?The text was updated successfully, but these errors were encountered: