Closed LawrenceKurowski closed 1 year ago
For me, this was because I was using the wrapper component MyCoolCodeBlock which uses the property "code" but I had mistakenly used a (non-existent) property "text". This was causing "null" to be passed into the "code" field. Solved by swapping property name.
Hi, If you still got this issue, please import a theme for it. Let's check code below:
import { CopyBlock, monokai } from "react-code-blocks";
...
<CopyBlock
language="bash"
text={`your code`}
theme={monokai}
/>
Because some properties are required inside the component.
Error when trying to use the solution described here.
Error message: TypeError: Cannot read properties of undefined (reading 'toString')
I copy-pasted the component exactly as is from here, installed the required library and included the import in the code, but can't make this to work as per error above.