Extensions

Press shift + S to search API reference.

React hook

useGlobalConfig

View source

Returns the extension's GlobalConfig and updates whenever any key in GlobalConfig changes.

import {Button, useGlobalConfig} from '@airtable/blocks/ui';
function SyncedCounter() {
const globalConfig = useGlobalConfig();
const count = globalConfig.get('count');
const increment = () => globalConfig.setAsync('count', count + 1);
const decrement = () => globalConfig.setAsync('count', count - 1);
const isEnabled = globalConfig.hasPermissionToSet('count');
return (
<React.Fragment>
<Button icon="minus" onClick={decrement} disabled={!isEnabled} ariaLabel="decrease"/>
{count}
<Button icon="plus" onClick={increment} disabled={!isEnabled} ariaLabel="increase"/>
</React.Fragment>
);
}

Function signature

function () => GlobalConfig