How to use "Code"
TimPietrusky opened this issue · comments
NERDDISCO commented
Issue description
The documentation is missing an example on how Code
should be used.
I'm trying it like this, but I only get errors:
<Code>
const helloWorld = foo => {
console.log(foo)
}
</Code>
or like this:
<Code>
{
const helloWorld = foo => {
console.log(foo)
}
}
</Code>
Steps to reproduce
- Open Code documentation
Versions
- dekk: 1.0.0-17
Gregor Adams commented
The documentation simply links to https://github.com/conorhastings/react-syntax-highlighter.
The code has to be a string
<Code>
{`
const helloWorld = foo => {
console.log(foo)
}
`}
</Code>
const code = `
const helloWorld = foo => {
console.log(foo)
}
`
<Code>
{code}
</Code>
NERDDISCO commented
Thank you! Would love to see this as part of the official documentation.
Also how to set the styling / formatting / language of the Code
element.