MDX in Next.js is Easy Now

  Рет қаралды 6,487

Colby Fayock

Colby Fayock

Күн бұрын

Пікірлер: 21
@colbyfayock
@colbyfayock 3 ай бұрын
Learn how to build a full stack Next.js app in my upcoming course: colbyfayock.com/course
@isaito77
@isaito77 3 ай бұрын
Dude you're a wizard. I spent nearly 12 hours today trying to get this exact functionality with mdx files typed up and with this video I can now go to sleep. Cheers !!!!
@colbyfayock
@colbyfayock 3 ай бұрын
glad i was able to help!! 🙌😁
@calvincrane
@calvincrane 15 күн бұрын
Good video, I learned a lot thank you. Seem to not be able to handle tables even with remark plugins. I did this with md already but not seen ot working with mdx.
@ibnurasikh
@ibnurasikh 3 ай бұрын
Very good video! My question is, do I need to rebuild every time new content is added or updated in MDX? I come from WordPress, where content can be published with just one click. Can this be achieved with MDX and Next.js, or do I still need to rebuild or redeploy?
@jengkhaw15
@jengkhaw15 3 ай бұрын
Since this is reading from fs, you would need to redeploy for updates. Just store your mdx (or whatever content) in a database and access it from nextjs if you want dynamic content.
@shreyashraj
@shreyashraj 3 ай бұрын
yes it will. If you don't want that you can use a database with markdowns but then power of jsx will be missing
@lostinthenarrativve
@lostinthenarrativve Ай бұрын
As soon as I try to install the dependencies I get loads and loads of configuration errors .
@marekjasiok6977
@marekjasiok6977 Ай бұрын
It's absolutely brilliant, and I'd like to set it up, too. However, desperately trying to reproduce this in Next 15, but I get the error: [ Server ] Error: A React Element from an older version of React was rendered. This is not supported. It can happen if: - Multiple copies of the "react" package is used. - A library pre-bundled an old copy of "react" or "react/jsx-runtime". - A compiler tries to "inline" JSX instead of using the runtime. I moved your project to Next 15 and it gives me the same error. What seems to have changed in between?
@colbyfayock
@colbyfayock Ай бұрын
perhaps its related to Next.js using React 19 in 15? try running npm list react and it might show the different versions and which dependency its related to
@marekjasiok6977
@marekjasiok6977 29 күн бұрын
@@colbyfayock thank you - it was React 18 - I now just created a brand new (@latest) next app with the tool (with React 19) and I can't npm i next-mdx-remote, I get a dependency error. Installing with the --legacy-peer-deps - will keep you posted if successful :-)
@RabahTaib-mn4fs
@RabahTaib-mn4fs 3 ай бұрын
How do you get code highlighting for mdx files?
@colbyfayock
@colbyfayock 3 ай бұрын
for that you typically can use processing tools such as remark which is a popular one, for instance: github.com/rehypejs/rehype-highlight i have a tutorial that walks through something similar but in HTML and a different use case: kzbin.info/www/bejne/gnexfqZunqqajq8 haven't used this but shiki is popular: shiki.style/packages/markdown-it#usage here's the official mdx page on options: mdxjs.com/guides/syntax-highlighting/ though seems like its a bit dated
@alireza1642
@alireza1642 3 ай бұрын
Why not using contentlayer?
@colbyfayock
@colbyfayock 3 ай бұрын
first i heard of it! maybe that'll be an upcoming vidoe "MDX is Even Easier Now" 🙃
@rtorcato
@rtorcato 3 ай бұрын
content layer is no longer maintained. There is a new package called velite
@colbyfayock
@colbyfayock 3 ай бұрын
@@rtorcato ah good to know, will check that one out then
@marwen_dev
@marwen_dev 3 ай бұрын
Yeah contentlayer is no longer maintained but contentlayer2 is lol😅. It works great 👍 just install contentlayer2 and follow the docs of contentlayer.
@immipixediter210
@immipixediter210 3 ай бұрын
Source Code or Example *.mdx files needed
@saadh393
@saadh393 3 ай бұрын
Best
@colbyfayock
@colbyfayock 3 ай бұрын
🙌
Lint & Format JavaScript with Biome
23:20
Colby Fayock
Рет қаралды 6 М.
Favicons the Right Way
18:07
Colby Fayock
Рет қаралды 11 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Pagination in React
29:05
Colby Fayock
Рет қаралды 4,3 М.
Realtime updates with next.js, socket.io and a redis publisher
16:14
The Story of Next.js
12:13
ui․dev
Рет қаралды 588 М.
MDX with Next.js App Router
12:33
leerob
Рет қаралды 14 М.
This Folder Structure Makes Me 100% More Productive
24:36
Web Dev Simplified
Рет қаралды 111 М.
Stop With Software Estimates
16:54
ThePrimeTime
Рет қаралды 149 М.
This Fixes CORS
13:02
Colby Fayock
Рет қаралды 7 М.
Create your own Next.js Starter Template
2:35:29
Syntax
Рет қаралды 39 М.