elrumordelaluz / reactour

Tourist Guide into your React Components

Home Page:https://react.tours

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conditionally Rendering Step Content

pulkit1joshi opened this issue · comments

Hi,

For content, I have a custom component.

`
const Component = () => {
const { paramName } = useParams();

if(paramName) => return somehing
return ( return something else)
}
`

[{
content: <?Component?>,
selector: '.selector'
}]

The param inside here returns null but the param used in the actual render component just before the step that uses this component returns correct value. I tried various permutations here, but found it weird.

My path is: /x/y/1

Inside the component added to the step:
useLocation returns: /x/y/1
useParam returns {} but it should return {z: 1}

Inside the component that is rendered in the above route:
useParam: returns {z: 1}

Hi @pulkit1joshi, thanks for open the Issue.

Mind creating a minimal reproduction in a sandbox in order to allow others to debug faster your use-case and try to find a solution as soon as possible? Thanks!