How to use the react-view.useView function in react-view

To help you get started, we’ve selected a few react-view 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 uber / baseweb / documentation-site / components / yard / index.tsx View on Github external
mapTokensToProps,
}) => {
  const [css, baseTheme] = useStyletron();
  const componentTheme = getThemeFromContext(baseTheme, theme);
  const themePrimitives =
    baseTheme.name && baseTheme.name.startsWith('dark-theme')
      ? 'darkThemePrimitives'
      : 'lightThemePrimitives';
  const provider = getProvider(componentTheme, themePrimitives);
  const {query, push, pathname} = useRouter();

  const initialCode = (typeof queryStringName !== 'undefined'
    ? query[queryStringName]
    : query.code) as string;

  const params = useView({
    componentName,
    props,
    scope: {
      ...scope,
      ThemeProvider,
      lightThemePrimitives,
      darkThemePrimitives,
      createTheme,
    },
    imports,
    provider,
    customProps,
    initialCode,
    onUpdate: ({code}) => {
      const query = queryStringName || 'code';
      push({