# Pass typescript class as a parameter to navigation between pages

**URL:** <https://community.dynatrace.com/t/pass-typescript-class-as-a-parameter-to-navigation-between-pages/42409>\
**Category:** Developer Q&A Forum\
**Tags:** dynatrace-app-toolkit, custom-app, platform-services, coding-assistance\
**Created:** [November 1, 2023, 2:43pm UTC](https://community.dynatrace.com/t/pass-typescript-class-as-a-parameter-to-navigation-between-pages/42409 "2023-11-01T14:43:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gilgi](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gilgi/32/11747_2.png) [@gilgi](https://community.dynatrace.com/u/gilgi)\
**Post date:** [November 1, 2023, 2:43pm UTC](https://community.dynatrace.com/t/pass-typescript-class-as-a-parameter-to-navigation-between-pages/42409/1 "2023-11-01T14:43:58Z")

</div>

Hi,

As a newbee to TypeScript: I have created a custom typescript class and I need to pass an instance of it from one page to the other. Is it even possible?

I know I can pass JsonObject using the useNavigate hook for example but this will not include all of the class functionalities.

How would you handle this? Should it just be as a single page with different components rendered based on the state of it and using “global” page variable with the class instance?

Gil.

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [November 2, 2023, 7:41am UTC](https://community.dynatrace.com/t/pass-typescript-class-as-a-parameter-to-navigation-between-pages/42409/2 "2023-11-02T07:41:24Z")

</div>

Hi&nbsp;[@gilgi](https://community.dynatrace.com/user/12008)

This is a question about how to manage states within React.

If you don’t have a complex component structure, you can share the states between components by lifting the state up and passing props. Please check out this page for more detailed examples:&nbsp;[Sharing State Between Components – React](https://react.dev/learn/sharing-state-between-components)

For more complex component structure I would suggest that you use context:&nbsp;[Passing Data Deeply with Context – React](https://react.dev/learn/passing-data-deeply-with-context)

BR,

Sini
