How to migrate from useLocalJsonForm to useJsonForm

I just opened an old project and upgrade the dependencies. And I just learned that useLocalJsonForm is deprecated. I’m not sure how to migrate the code, but switching to useJsonForm loses my form…

Any guidance is appreciated … thanks

You can hook the form up to the CMS with usePlugin.

import { useJsonForm } from 'gatsby-tinacms-json'
import { usePlugin } from 'tinacms'

export const Page = props => {
  const [values, form] = useJsonForm(
    //...
  )
  usePlugin(form)
  //...
}
2 Likes

Hey @philipsaa thanks for your question,

the easiest way to do this is to just do

const [values, form] = useJsonForm(jsonFile, options)
usePlugins(form)

Edit: looks like @dj beat me to it

2 Likes