How do i run the sample page in openmrs-react-components repo?

@mksd @mogoodrich @jomadoye. I cloned the repo on my machine. How do I run the sample page app from samples? Is anywhere a wiki page about this repo ? Thank you.

Cc @ayesh , you might also be able to unlock @andu033?

He’s integrating his first components on his fork and would like to know how to set himself up to test them at runtime? Is this documented anywhere?

2 Likes

Hi @mksd @andu033

You can find a demo repo which was setup by @beingtmk here to showcase the usage of react components.There he has the guidance to setup it.Hope this would help

Cc :- @judeniroshan

2 Likes

I get this error: “Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it’s defined in, or you might have mixed up default and named imports.”

@ayesh, @andu033 The above repository is based on new components that i am adding to the repository!

1 Like

@andu033, You are getting the above error because the above repo is based on my fork of open-mrs-react components, and the main repo doesnt contain the components used in the above repository

@beingtmk

can u let us know how to run the samples in the react-component repository.If so it would be great.

@andu033 & @ayesh, I checked out the samples, actually the sample is using the Login Page component & the login page component requires a backend to work as it queries the openmrs rest endpoint for verification.

@andu033 and @ayesh,

Check this repo out, this repo is currently using the openmrs-react-components repository

You will also need to setup a server backend, i am using the mirebalais module & malawi module as backend for testing

Detailed instructions to setup are given in their individual Readme

2 Likes

Awesome thanks @beingtmk

1 Like

@mogoodrich, where can i get the de-identified database backup for PIH-Malawi?

Hey @beingtmk, how are you?

What are looking to do? Test the APZU app?

Let me talk with the team on Monday about getting you access… I suspect the Malawi team will push back on giving access to the entire database to people outside PIH/APZU (even de-identified), but there’s a de-identified staging server that I might be able to get you access to, but I’d need to get approval.

Take care, Mark

1 Like

I did the setup of the backend server but i still get the same error. Maybe i did it incorectly?

1 Like

Did you add a env.local file specifying the endpoint and port, Also be aware of CORS issue, it would awesome if you could provide the exact error

How do i do that?

1 Like

Install this plugin

1 Like

Another way to get around the CORS issue is to run Chrome without the CORS restriction:

Or, I just installed Chromium, and then ran it without security:

$ /Applications/Chromium.app/Contents/MacOS/Chromium --disable-web-security --user-data-dir=""

It worked. Thanks. Now i can test my components. But i have one more problem. If i change something in react-components and then run build:watch it will undo the changes. Any idea why?

1 Like

Hi @andu033, This doesn’t happen with me!

Can you pls elaborate, i can’t figure it out just based on the above information?