I was wondering if its possible to render an entire react app in a non react web page. I tried many links where it suggested code snippets as follows which shows to render just
See comments on question for more context on this answer
Example
import React from 'react'
import { render } from 'react-dom'
import { createStore } from 'redux'
import { Provider } from 'react-redux'
import { App } from './app'
window.mount = function(id, customText) {
const store = createStore((state = {}) => state)
render(
,
document.getElementById(id)
)
}
import React from 'react'
export const App = ({ text }) => {
return (
{text}
)
}
This only has redux integration in so far as it creates a store and wraps the app in a Provider
, but I can't see any reason why it wont work like normal from there.
I tested this using webpack to bundle and webpack-dev-server to serve.