0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-25 12:48:12 +00:00

moving towards SPA

This commit is contained in:
Víctor Losada Hernández
2026-02-01 17:28:21 +01:00
parent 390ff68a6b
commit 820160d0f5
5 changed files with 138 additions and 90 deletions

View File

@@ -1,13 +1,16 @@
import React from 'react'
import { hydrateRoot } from 'react-dom/client'
import Homebrew from './homebrew/homebrew.jsx'
import React from "react";
import { hydrateRoot } from "react-dom/client";
import Homebrew from "./homebrew/homebrew.jsx";
// CSS MUST be imported here
import './homebrew/homebrew.less' // or wherever your CSS lives
import "./homebrew/homebrew.less"; // or wherever your CSS lives
window.start_app = (props) => {
hydrateRoot(
document.getElementById('reactRoot'),
<Homebrew {...props} />
)
// Polyfill `global` in the browser
if (typeof global === 'undefined') {
window.global = window;
}
console.log("entry-client-homebrew");
const props = window.__SSR_PROPS__ || {};
console.log("props: ", props);
hydrateRoot(document.getElementById("reactRoot"), <Homebrew {...props} />);

29
client/index.html Normal file
View File

@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, height=device-height, interactive-widget=resizes-visual"
/>
<link
href="//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700"
rel="stylesheet"
type="text/css"
/>
<link rel="icon" href="/assets/favicon.ico" type="image/x-icon" />
<!-- Optional: static OG defaults -->
<meta name="twitter:card" content="summary" />
<title>The Homebrewery - NaturalCrit</title>
</head>
<body>
<main id="reactRoot"></main>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>

5
client/main.jsx Normal file
View File

@@ -0,0 +1,5 @@
import { createRoot } from "react-dom/client";
import App from "./App";
const root = createRoot(document.getElementById("reactRoot"));
root.render(<App />);