Rajdeep Singh
Mar 8, 2023

--

But I can understand why you need this functionality. If you handle it with ContextAPI, then go with it.

But I'm 100% sure you can not pass a setData reference with href.

```

href={{

pathname: "/Blog",

query: { slug: setData },

}}

# or

href="/setData."

```

because href accepts only a string value.

Before writing the answer, firstly, I tested and wrote to answer your question.

checkout the code https://codesandbox.io/p/sandbox/friendly-hooks-r2c648

open Header and Blog component where i test it.

--

--

Rajdeep Singh
Rajdeep Singh

Written by Rajdeep Singh

Follow me if you learn more about JavaScript | TypeScript | React.js | Next.js | Linux | NixOS | Frontend Developer | https://linktr.ee/officialrajdeepsingh

No responses yet