3

I am going to build an embeddable widget using React.js library. I built the widget using the command "parcel build src/index.js --no-source-maps -d widget" successfully. But when running the js and css files which are built in any website, I have encountered an error "Uncaught Error: Minified React error #299". I researched many blogs, but I haven't found the solution. Please let me know the solution if you have experience.

enter image description here

1

1 Answer 1

9

I had this same error with my React app - a similar embeddable widget app as well. The way I fixed it was when I added the widget to a webpage, I had to add a div with the "root" id - the error comes from not being able to create a root for the app so by explicitly adding a root div then the app rendered properly.

Something like this:

<div id="root"></div>
<script src="path-to-script.js"></script>

Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

You saved me, I copied similar code but your explanation made me realize that the div's id and the script's id should be the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.