getPropsFromParams
function
💡
This documentation covers an older version of Next Admin. If you are using the
latest version (>=5.0.0
and above), please refer to the current
documentation.
The following function should be used only for App Router.
getPropsFromParams
is a function that returns the props for the NextAdmin
component. It accepts one argument which is an object with the following properties:
params
: the array of route params retrieved from the optional catch-all segment (opens in a new tab)searchParams
: the query params retrieved from the page (opens in a new tab)options
: the options objectschema
: the json schema generated by theprisma generate
commandprisma
: your Prisma client instanceaction
: the server action (opens in a new tab) used to submit the form. It should be your own action, that wraps thesubmitForm
action imported from@premieroctet/next-admin/dist/actions
.deleteAction
: the server action (opens in a new tab) used to delete one or more records in a resource. It is optional, and should be your own action. This action takes 3 parameters:model
(the model name) andids
(an array of ids to delete). Next Admin provides a default action for deletion, that you can call in your own action. Check the example app for more details.getMessages
: a function with no parameters that returns translation messages. It is used to translate the default messages of the library. See i18n for more details.searchPaginatedResourceAction
: the server action (opens in a new tab) used to search for resources in a selector widget. This is mandatory for App Router, and will be ignored on page router. Just likeaction
, it should be your own action that wrapssearchPaginatedResource
imported from@premieroctet/next-admin/dist/actions
.