What is MDX? Why it is so awesome ๐Ÿ”ฅ

Dilip Kumar
3 min readJan 16, 2021

If you are new to markdown and havenโ€™t heard about it, no worries ๐Ÿ˜‰, let me introduce you to the world of Markdown ๐ŸŒŽ. Markdown is plain text formatting syntax that converts your text into a valid HTML.

Markdown makes it easier when you are writing a whole bunch of lines.๐Ÿ˜‡ Let's see now how it looks like You must have used GitHub readme ๐Ÿค” once or a while, GitHub readme uses markdown.๐Ÿ˜€

How markdown looks like

once you click on the preview button you will see it get converted to valid HTML like this

After markdown conversion

isnโ€™t it is cool how plain text is getting converted to HTML. ๐ŸฅณIf you wanted to create bold text you would use **text** and so on, you can read more about Markdown on this. You can even use custom HTML elements here if you wish to use.

Then why ๐Ÿคทโ€โ™‚๏ธ there is so much noise about MDX when Markdown is already that good and powerful

There are certain scenarios where things are not fitted well with markdown. For Example

Markdown limits

Here we have to repeat the same thing twice but all we wanted is to change the name of the user, and this template can go along as we do with JSX i.e creating a component then reusing it with passing some props

JSX in markdown

but JSX is not allowed in markdown,๐Ÿ™ it is where MDX came into the picture. ๐Ÿ˜‹

So, MDX gives leverage the power of using Markdown along with allowing you to use JSX inside it so that you can do a whole lot of things inside markdown ๐Ÿ˜Ž, something like including a carousel inside your markdown.

JSX inside Markdown

So now this is allowed in JSX and this will look like something like this.

If you enjoyed reading and learnt something from this article, all I ask you to do is ๐Ÿ‘ this. You can share your view also in the comment and your queries if you have after reading. Thank you

--

--

Dilip Kumar

Frontend Developer @Invizai. Loves to build web design and product. Always available to contribute