Upgrading to v0.65
This page is out of date. Learn TinaCMS.
The "apiURL" prop
Previously, setting up TinaCMS looked like this:
It was a tad clunky, as branch and clientId didn't do anything if isLocalClient was set to true.
We've deprecated isLocalClient, branch, and clientId, and replaced them with a single api url prop:
A common full implementation is:
The introduction of useTina
useTina allows devs to register forms, and setup visual editing on a page-level, rather than having to pass everything through the root <TinaCMS> provider
Example implementation
For the full example, see the basic starter in this PR: https://github.com/tinacms/tinacms/pull/2426/files#diff-42691b463aec5743dc024951e2db4ed514228f73d276082d4e6e1cdad9b1b246
Note! You can only have oneuseTinaregistered at a time, or they will step on each other.
You will also notice that TinaCMS now renders a ReactNode, instead of render props as its children:
You can read more about the reasoning behind the change in the initial PR
Common issues
Content not contextually updating
If you wire this up on your site, and the forms are registered but the main content isn't contextually updating based on the sidebar values, then you likely aren't using the data value from useTina
The likely fix:
Register layout-level forms
A layout level "QueryContainer" can be created to register the useForm hook at a higher level than pages, if you're looking to make something outside of your pages editable.