DEV Community

Discussion on: Compound Components Pattern in React

Collapse
 
amankumarsingh01 profile image
Aman Kumar Singh

If you would like to add syntax coloring to your code:

Markdown - how to make blocks of React code (syntax highlighting - github, dev.to)

I personally struggeled with this.

At the beginning of the src code line after 3 x the grave accent sign, we need to add jsx.

Collapse
 
pcjmfranken profile image
Peter Franken • Edited

Like so:

# Markdown

Space, the final frontier. These are the voyages of the Starship Enterprise. Its five-year mission: to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no man has gone before.

Code block:

`​``jsx
import React from 'react'

export default function Hai({ children }){
  return '<h1>{children}</h1>'
}
``​`

Fin.
Enter fullscreen mode Exit fullscreen mode