How to use the @storybook/client-api.useMemo function in @storybook/client-api

To help you get started, we’ve selected a few @storybook/client-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / renderers / react / src / client / index.tsx View on Github external
outer: async (getStory, context) => {
    const node = useMemo(() => document.createElement('div'), [context.kind, context.name]);
    useEffect(() => () => ReactDOM.unmountComponentAtNode(node), [node]);
    await render(getStory(context), node, context);
    return node;
  },
});
github JetBrains / ring-ui / .storybook / react-decorator.js View on Github external
const reactDecorator = (story, context) => {
  const node = useMemo(
    () => document.createElement('div'),
    [context.kind, context.name]
  );
  useEffect(() => () => ReactDOM.unmountComponentAtNode(node), [node]);
  ReactDOM.render((
    
      {story()}
    
  ), node);
  return node;
};