Is there documentation or tutorial on how to transition from using d2 library to app platform

I am trying to upgrade some app that uses the d2 and app-runtime-adapter-d2 libraries to using the App Platform as recommended. Is there a documentation or article on how to transition?

Particularly, how do I handle cases of Post, Update and Delete requests that uses the d2 API. Also the getInstance from d2?

1 Like

Hey @jetisco4u! I don’t think we have any specific documentation about migrating away from from using d2 for data fetching and mutations unfortunately, but the data tools from the @dhis2/app-runtime library may be what you’re looking for :slight_smile:

It uses a declarative, React hook-based API, so it will be a bit different than using the d2 API. The useDataQuery() hook (link to docs) can perform the GET requests, and the useDataMutation() (link to docs) hook can achieve POST, PUT, and DELETE actions by using type: 'create' | 'update' | 'delete' when defining the mutation. getInstance() from d2 won’t be necessary when using the App Runtime :+1:

If you want a very thorough tutorial on how to use the app-runtime library, we have some videos from a web development academy that can be useful:

Good luck and happy coding! :slight_smile:

4 Likes