SoftwareBrothers / adminjs-design-system

DesignSystem on which AdminJS is based on
28 stars 33 forks source link

designSystem.useRecord is not a function #5

Closed johnstan closed 3 years ago

johnstan commented 3 years ago

I've got a simple component that was working in earlier versions of admin-bro, but now that I've updated and added in design-system, etc. useRecord refuses to work and gives the error in the title. The import is:

import { Box, useRecord, useTranslation } from '@admin-bro/design-system'

Then using it as:

const { record: initialRecord, resource, action, property } = props const { record, handleChange, submit } = useRecord(initialRecord, resource.id)

The page throws a Javascript error: Uncaught TypeError: designSystem.useRecord is not a function at AltuserComponent (components.bundle.js:1103) at renderWithHooks (global.bundle.js:37614) at mountIndeterminateComponent (global.bundle.js:40293) at beginWork (global.bundle.js:41407) at HTMLUnknownElement.callCallback (global.bundle.js:22999) at Object.invokeGuardedCallbackDev (global.bundle.js:23048) at invokeGuardedCallback (global.bundle.js:23103) at beginWork$1 (global.bundle.js:46014) at performUnitOfWork (global.bundle.js:44968) at workLoopSync (global.bundle.js:44941)

Any idea what I'm doing wrong?

SimonB407 commented 3 years ago

useRecord is not a part of design-system, rather admin-bro package itself.

johnstan commented 3 years ago

Can the examples then be updated as they show this incorrectly