import ForgeUI, {Avatar, render, Fragment,useProductContext, Macro, Text, ConfigForm, TextArea, useConfig} from "@forge/ui";
const App = () => {
const config = useConfig();
console.log(useConfig());
const terms = config && config.terms.split('\n');
const definitions = [];
const { contentId } = useProductContext();
if (!config || !config.terms) {
return <Fragment>
<Text>No terms</Text>
</Fragment>
}
return (
<Fragment>
<Text>{terms.join(",")}</Text>
</Fragment>
);
};
export const Config = () =>
<ConfigForm>
<TextArea
label="Terms to include (one per line)"
name="terms"
isRequired
/>
</ConfigForm>;
export const run = render(
<Fragment>
<Avatar accountId="5a1234bc8d12345e3f1g11hi" />
<Macro
app={<App />}
config={<Config/>}
/>
</Fragment>
);
why useConfig is not useful
i console it is undefined;