How to use @tinacms/react-core - 4 common examples

To help you get started, we’ve selected a few @tinacms/react-core 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 tinacms / tinacms / packages / @tinacms / form-builder / src / final-form-builder.tsx View on Github external
export function FieldsBuilder({ form, fields }: FieldsBuilderProps) {
  const cms = useCMS()
  return (
    
      {fields.map((field: Field) => {
        if (field.component === null) return null

        const plugin = cms.plugins
          .findOrCreateMap('field')
          .find(field.component as string)

        let type: string | undefined
        if (plugin && plugin.type) {
          type = plugin.type
        }

        const parse = getProp('parse', field, plugin)
        const validate = getProp('validate', field, plugin)
github tinacms / tinacms / packages / tinacms / src / react-tinacms / use-cms.ts View on Github external
export function useCMS(): TinaCMS {
  return useBaseCMS() as TinaCMS
}
github tinacms / tinacms / packages / tinacms / src / react-tinacms / use-form.ts View on Github external
export function useGlobalForm(
  options: FormOptions,
  watch: Partial = {}
): [FormShape, Form | undefined] {
  const [values, form] = useForm(options, watch)

  const GlobalForm = useMemo(() => {
    if (!form) return

    return new GlobalFormPlugin(form)
  }, [form])

  usePlugins(GlobalForm)

  return [values, form]
}
github tinacms / tinacms / packages / tinacms / src / react-tinacms / use-form.ts View on Github external
export function useGlobalForm(
  options: FormOptions,
  watch: Partial = {}
): [FormShape, Form | undefined] {
  const [values, form] = useForm(options, watch)

  const GlobalForm = useMemo(() => {
    if (!form) return

    return new GlobalFormPlugin(form)
  }, [form])

  usePlugins(GlobalForm)

  return [values, form]
}

@tinacms/react-core

_Note: This is an internal module for interacting with the `@tinacms/core`. It is meant for use within `tinacms`. You probably want to be using `react-tinacms`._

Apache-2.0
Latest version published 3 years ago

Package Health Score

62 / 100
Full package analysis

Similar packages