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
Copyright © 2025 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.