useConfig is not useful

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;

Hi @111112

It is probably undefined because no config values from the properties dialog have been set for that page.

Also, the code looks a bit difficult to follow. Try following https://developer.atlassian.com/platform/forge/add-configuration-to-a-macro/ to get things working.

1 Like

I according to the demo https://developer.atlassian.com/platform/forge/create-confluence-macro-with-storage-api/
Even if the Bitbucket also cant use