question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plans to fetch data using co-location within JSX

See original GitHub issue

The newly announced Next.js 12 signals a future shift by the Next team to move away from ‘data functions’ like getStaticProps to co-locating data collection within JSX.

Builds using experimental React 18 (which is in alpha) features - like SSR and RSC - on Next 12 currently fail.

Are there plans to adapt the next-mdx-remote package into this new model?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

28reactions
jescalancommented, Oct 28, 2021

Yes

3reactions
noahlstcommented, Apr 7, 2022

At this time, if you’re experiencing errors with React 18 concurrency features, check:

  • that next-mdx-remote is pinned at version 4.0.1
  • that you are using the latest version of Next.js (12.1.4 at writing)
  • that you’re using the latest version of React (i.e. 18.0.0 proper)
  • that your next.config.js includes experimental: { runtime: "nodejs"} (Edge Runtime disables eval which this library requires)

If none of that works try adding this to your next.config.js:

webpack: (config) => {
    config.resolve.alias = {
      ...config.resolve.alias,
      "react/jsx-runtime.js": path.resolve("node_modules/react/jsx-runtime"),
    };
    return config;
  },

Or you can try require.resolve instead of path. This is courtesy of @jakejarvis

Note that, with time, this will probably break!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fetch data in React with performance in mind
Deep dive into data fetching in React. What is performance, fundamental libraries-agnostic patterns and techniques, how react lifecycle and ...
Read more >
A comprehensive guide to data fetching in React
There is a variety of ways to fetch data in React, including using the inbuilt Fetch API, Axios, and more. We'll go over...
Read more >
Data Fetching Patterns for a Better User Experience - InfoQ
In a React context, the application is implemented with components, and each component may fetch its required data when it mounts. Meanwhile, a ......
Read more >
React Fetch: Ultimate Guide to Fetching Data - CopyCat Blog
In this guide, you'll learn how to use Fetch to send or get data across networks and comfortably consume APIs, with examples +...
Read more >
Building Scalable and Efficient React Applications Using ...
It's passed because it is the object inside the query that spreads the fragment needed by the two components. This is how Relay...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found