Hello everyone, have any of you done a project wit...
# dev
d
Hello everyone, have any of you done a project with nextJs using the medplum react sdk? I am including these two hooks in the layout.tsx for using the component signInForm.
Copy code
const medplum = useMedplum();
const profile = useMedplumProfile();
but I get the following error: node_modules/@medplum/react/dist/esm/index.mjs (1:14253) @ eval ⨯ TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_0__.createContext) is not a function at eval (webpack-internal:////(rsc)/./node_modules/@medplum/react/dist/esm/index.mjs:665:75) at (rsc)/./node_modules/@medplum/react/dist/esm/index.mjs (/home/davidzul/Documents/practitioner-portal/.next/server/vendor-chunks/@medplum.js:30:1) Has this happened to anyone?
r
@alan - I know you've used NextJS in the past, right?
@davidfza92 - it seems like you're running into a more general issue around react components. Take a look at this SO post: https://stackoverflow.com/questions/74255356/typeerror-react-createcontext-is-not-a-function-nextjs-13-formik-with-typesc
a
I looked NextJS with application router. To incorporate the Medplum React SDK, it's necessary to add 'use client'. I believe the layout.tsx operates on the server side, pages can be either.
d
Thanks to everyone, i see this example: https://github.com/medplum/medplum-nextjs-demo/tree/main
157 Views