Extensions

Press shift + S to search API reference.

React hook

useSynced

View source

A hook for syncing a component to GlobalConfig. Useful if you are dealing with a custom input component and can‘t use one of our Synced components.

import {useBase, useSynced} from '@airtable/blocks/ui';
function CustomInputSynced() {
const [value, setValue, canSetValue] = useSynced('myGlobalConfigKey');
return (
<input
type="text"
value={value}
onChange={e => setValue(e.target.value)}
disabled={!canSetValue}
/>
);
}

Function signature

function (globalConfigKey: GlobalConfigKey) => [unknown, function (newValue: GlobalConfigValue | undefined) => void, boolean]