Fetch dictionary data with the JSS GraphQL Dictionary Service
Version:
You can fetch dictionary data from Sitecore using GraphQL and the JSS GraphQLDictionaryService.
Note
This example assumes you create the files in the root directory of the application and that you have a config.js file in that same directory. Adjust the import statements as necessary to reflect your project's setup.
To fetch dictionary data with the JSS GraphQL Dictionary Service:
-
In a
dictionary-service.tsfile, create and configure an instance of theGraphQLDictionaryService: -
In the file where you want to fetch the data, import and use your new dictionary service instance: