How to use the tinacms.useWatchFormValues function in tinacms

To help you get started, we’ve selected a few tinacms 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 / gatsby-tinacms-remark / src / useRemarkForm.tsx View on Github external
label,
      fields,
      values: valuesOnDisk,
    }
  )

  /* eslint-disable-next-line react-hooks/rules-of-hooks */
  const writeToDisk = React.useCallback(formState => {
    cms.api.git.onChange!({
      fileRelativePath: formState.values.fileRelativePath,
      content: toMarkdownString(formState.values),
    })
  }, [])

  /* eslint-disable-next-line react-hooks/rules-of-hooks */
  useWatchFormValues(form, writeToDisk)

  return [markdownRemark, form]
}
github celo-org / celo-monorepo / packages / web / src / brandkit / Tina.tsx View on Github external
})
    },
  })

  const writeToDisk = React.useCallback((formState) => {
    cms.api.git.writeToDisk({
      fileRelativePath: props.fileRelativePath,
      content: JSON.stringify({
        title: formState.values.title,
        headline: formState.values.headline,
        markdown: formState.values.markdown,
      }),
    })
  }, [])

  useWatchFormValues(form, writeToDisk)

  return (
    <>
      
            ),
          },
        ]}
      />

tinacms

[![GitHub license](https://img.shields.io/github/license/tinacms/tinacms?color=blue)](https://github.com/tinacms/tinacms/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/tinacms.svg?style=flat)](https://www.npmjs.com/package/tinacms) [![Bui

Apache-2.0
Latest version published 9 days ago

Package Health Score

89 / 100
Full package analysis