Closed babur001 closed 3 years ago
Hi there! Seems to work fine: https://codesandbox.io/s/using-craco-forked-c6wsg?file=/src/App.js.
toHtml
and dangerouslySetInnerHTML
defeats the purpose of refractor
— the whole reason to use refractor
is so you don’t need to do dangerouslySetInnerHTML
refractor
to latest, there was a small issue patched in the last releaseIn development yes it does work, but whenever i switch to production it says Error: Unknown language: "html" is not registered
.
To create a mock go here and try visiting the production not dev
Please follow my second suggestion. Your packag lock Says 4.1.0 and thus was most likely fixed on 4.1.1: https://github.com/wooorm/refractor/releases/tag/4.1.1
It works!
Thanks, God bless you.
Also, Using toHtml and dangerouslySetInnerHTML defeats the purpose of refractor — the whole reason to use refractor is so you don’t need to do dangerouslySetInnerHTML
how can i render it in react? 👀 Can you show the way you handle it?
Node -v 14.17.4 React -v 17
I am using @craco/craco to configure webpack, so after I have generated an app with
npm run build
and visiting the build app withserve -s build
shows an empty page. On the console it saysError: Unknown language:
htmlis not registered
, however I have imported the refractor asimport { refractor } from "refractor/lib/common.js"
and also tried in this wayimport { refractor } from "refractor";
, both ways does not seem to work.Scripts in
package.json
: