Incorporate raw HTML into a React app.
This is a working example that showcases how you might incorporate raw HTML into a React app at runtime. This is a use-case when your app has a source of raw HTML that it needs to incorporate into the web page. For example, you might have a Markdown document that you send to the GitHub "markdown-to-HTML" API and now you want to splice the HTML into the page.
I posted this code as an answer to a StackOverflow question.
Follow these instructions to build and serve the program:
- Pre-requisite: Node.js
- I used version 20.11.0
- Install the dependencies
-
npm install
-
- Serve the content (and build continuously)
-
npm start
-
- Open the browser
- Open http://[::1]:8000
- Verify the UI and iterate!