I am facing a TypeError " Add is not a function" when I try adding a value to an object using the useSavedObject Hook as described in the latest DHIS2 Web Data Store Tutorial on Youtube.
I am on DHIS2 2.34.1 and use the following package “@dhis2/app-service-datastore”: “^1.0.0-alpha.2”
Please find below the code that I am running, any idea what I am missing?
import { useSetting, useAllSettings, useSavedObject, useSavedObjectList } from ‘@dhis2/app-service-datastore’;
import {useConfig} from ‘@dhis2/app-service-config’;
@dieng I am not sure useSavedObject is what you want here - the baseUrl should be accessible with the useConfig hook from any component in your application. Are you saving multiple “saved objects” or saving any additional information in your saved object?
@nnkogift As usual, thank you for your clear and prompt response, I got the gist of it and was able to save all I wanted!
Hi @austin Thanks for checking in, I will be saving one saved object for an App that can adapt itself to different DHIS2 instance with different baseURL. I will then use the useSavedObject Hook to update specific keys.