Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't use React Markdown with Next JS #767

Closed
4 tasks done
mshaheeruddin opened this issue Sep 7, 2023 · 7 comments
Closed
4 tasks done

can't use React Markdown with Next JS #767

mshaheeruddin opened this issue Sep 7, 2023 · 7 comments
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on

Comments

@mshaheeruddin
Copy link

Initial checklist

Affected packages and versions

8.0.7

Link to runnable example

No response

Steps to reproduce

I was working on a Next JS application.

As I installed react-markdown by using npm install react-markdown, and started dev server, it crashed with the error:

**Server Error
TypeError: Cannot read properties of null (reading 'useContext')

This error happened while generating the page. Any console logs will be displayed in the terminal window.**

I tried cleaning my cache [as it also happened with another package but after cleaning cache and running npm install it resolved] but it didn't solve the issue.

As I uninstall react-markdown, my app runs fine without any issues.

P.S: Just to be clear, I haven't used Context API anywhere (no state management tool at all)

Also my Node version is latest Node.js v18.16.1.

Expected behavior

It should show my app working fine

Actual behavior

Server Error
TypeError: Cannot read properties of null (reading 'useContext')

This error happened while generating the page. Any console logs will be displayed in the terminal window.

Runtime

Other (please specify in steps to reproduce)

Package manager

No response

OS

Windows

Build and bundle tools

Next.js

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Sep 7, 2023
@wooorm
Copy link
Member

wooorm commented Sep 7, 2023

https://github.com/search?q=repo%3Aremarkjs%2Freact-markdown%20useContext&type=code

This is not a problem here. Needs more info

@wooorm wooorm added the 🙉 open/needs-info This needs some more info label Sep 7, 2023
@github-actions

This comment has been minimized.

@ChristianMurphy
Copy link
Member

ChristianMurphy commented Sep 7, 2023

Welcome @mshaheeruddin! 👋
Sorry you ran into a spot of trouble.
As @wooorm notes, react-markdown doesn't leverage the useContext API.
It is highly unlikely, nearly impossible for react-markdown to be the root cause.

Some things to consider:

  • Are there any other components on the page which may be leveraging context?
  • Are you including multiple different versions of react on the page? (though dependencies, check your package lock file)
  • Are you sure your build tool is configured correctly?

@mshaheeruddin
Copy link
Author

Can this be an issue from Next JS side?

I am really sure that I haven't used Context API anywhere
Problem is getting resolved as soon as I uninstall react-markdown package (have checked this twice)

I don't know how to check for this:

Are you including multiple different versions of react on the page? (though dependencies, check your package lock file)
Are you sure your build tool is configured correctly?

@ChristianMurphy
Copy link
Member

Issues are not the place for Q&A, I'm copying this over to https://github.com/orgs/remarkjs/discussions/1228.
Let's continue the conversation there.

@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2023
@ChristianMurphy ChristianMurphy added 👀 no/external This makes more sense somewhere else and removed 🙉 open/needs-info This needs some more info 🤞 phase/open Post is being triaged manually labels Sep 7, 2023
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions bot added the 👎 phase/no Post cannot or will not be acted on label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

3 participants