My collection is performing an API request so I want to add a button that will make the initiate the request and save the page
I’ve got an admin component setup but I’m unsure on how to make the page save
I began following the examples here -
https://payloadcms.com/docs/admin/components#collectionsbut run into errors:
'DefaultButton' refers to a value, but is being used as a type here. Did you mean 'typeof DefaultButton'?ts(2749)Type 'boolean' is not assignable to type '() => void'.ts(2322)The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.ts(2362)I'm guessing DefaultButton needs importing but I dont know where to import it from
i import it from "payload/dist/admin/components/elements/Button"
but thats button, so somewhere in elements there should be an element called DefaultButton
I removed that line and returned some text, didn't realise but It's not what I need.
I need a new button at the bottom of an edit view that will save the page.
I'm now using this example but again get errors everywhere when i use the supplied code
Its being imported at the top like
import React, { Fragment, useEffect } from 'react'are you by some chance writing jsx components in a ts file?
HAH thats the one, thats got me a couple times!
Thank you!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.