Authors:
Cameron Johns, Cille Schliebitz, Anita Gu
Changed on:
3 Feb 2025
This lesson addresses the best practice of avoiding hardcoded values, specifically API keys, within components. We'll explore how to use the
`useSettings`
`useSettings`
`useSettings`
In the previous steps, the API key for the Google Map component is hardcoded —this is not considered best practice, since it does not make the component configurable for other clients and environments.
This could be turned into another component prop, but something like an API key might make more sense as a setting if it's used in other places (components, rules, etc.). Then, if you need to update the key, you can do it in one place rather than digging into manifests and workflows.
The Component SDK provides a useful hook called
`useSettings`
Watch the video below for steps to load the key from the platform setting:
This video explains how to make a component configurable for other clients and environments