What is MDX? Why it is so awesome ๐ฅ
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.๐
once you click on the preview button you will see it get converted to valid HTML like this
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
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
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.
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