Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

My React file is failing to compile what can i do to make it work?

This is the error i’m getting

The directories are correct, but i’m experiencing some difficulties with this, basically i’m using css code as well.

The page is not showing anything. Just that and when i run:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel


npm run dev

it shows this:

What i see!

>Solution :

You’re trying to use useState in a component that your app is treating as a server component.

To fix this, in your src/app/page.tsx put this as the first line in your file:

"use client"

This will tell next that this is meant to be a client component so you can now safely make use of useState.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading