A React web app port of the Calculus Quick Notes Android app, adding interactive D3 and Three.js visualizations to the original static content.
Live at: calculusquicknotes.com
This app was originally hosted on iPage (now Network Solutions). It has since been migrated to GitHub Pages, which offers tighter integration with the source repository and automatic deployment via GitHub Actions on every push to master.
GitHub Pages serves only static files and has no server-side routing. The following are already in place to handle this correctly:
404.htmltrick — The deploy workflow copiesbuild/index.htmltobuild/404.html. When a user navigates directly to a deep URL (e.g./PreCalculus/ShiftingGraphsWithHAndK), GitHub Pages serves404.html, which loads the React app and lets React Router handle the route client-side. Without this, direct links and page refreshes would show a real 404.- Custom domain —
package.jsonhas"homepage": "https://calculusquicknotes.com"and aCNAMEfile is committed to the repo. CRA uses thehomepagevalue to correctly set asset paths at build time. - Code splitting — Lazy-loaded page chunks are just static
.jsfiles served from GitHub Pages' CDN.React.lazy()requests them on demand exactly like any other static asset.
npm startOpens at http://localhost:3000. The page hot-reloads on file changes.
Tip: If you see "Something is already running on port 3000", an old dev server is still running. Kill it first:
lsof -ti :3000 | xargs kill -9 npm startRunning two servers simultaneously means your changes won't appear — you'll be testing against the old one.
Deployment is fully automatic. Just push to master:
git add .
git commit -m "your message"
git pushThe GitHub Actions workflow (.github/workflows/deploy.yml) will:
- Install dependencies
- Build the production bundle (
npm run build) - Copy
index.html→404.html(required for client-side routing on GitHub Pages) - Deploy the
build/folder to thegh-pagesbranch
You can monitor the deployment under the Actions tab on GitHub. The live site updates within ~1 minute of the workflow completing.
Note: You do not need to run
npm run buildornpm run deploymanually. Those commands exist but the GitHub Actions workflow handles everything on push.
Pages are lazy-loaded using React's built-in React.lazy() + Suspense. Each page gets its own unique lazy() component so React fully unmounts the old page and mounts the new one on navigation — preventing stale content from ever being shown.
A <LoadingPage /> fallback (animated) is shown while a page's chunk is loading.
History: The project originally used
@loadable/componentfor code splitting, which was the standard solution before React had built-in lazy loading.@loadable/component's main advantage overReact.lazyis SSR support — but since this app is statically hosted (no SSR),React.lazyis the simpler, dependency-free equivalent. The migration also fixed a navigation caching bug where sharing a single dynamic loadable component type across all pages caused React to reuse the old instance instead of mounting a fresh one.
Pages are registered in src/pages/pageDirectory.json. Adding a new page requires:
- Creating
src/pages/[SectionName]/[PageName]/[PageName].jsx - Adding the entry to
pageDirectory.json
Uses React Router v6 with BrowserRouter. Routes are built at module level from pageDirectory.json and matched to their lazy-loaded page components. The basename is set to process.env.PUBLIC_URL to support the custom domain.
- D3.js — used for 2D interactive graphs (charts, series visualizations, etc.)
- Three.js / React Three Fiber — used for 3D visualizations (volume solids of revolution, etc.)
- MathJax v2 — renders all mathematical notation via
better-react-mathjax
- MUI (Material UI v7) with Styled Components engine
- Custom color palette in
src/interactivity/resources/constants/ - Global background color set via MUI
GlobalStyles
| Package | Purpose |
|---|---|
react-router-dom |
Client-side routing |
@mui/material |
UI component library |
d3 |
2D interactive data visualizations |
three + @react-three/fiber + @react-three/drei |
3D visualizations |
better-react-mathjax |
MathJax v2 integration for math rendering |
big.js |
Arbitrary precision arithmetic for graph calculations |
troika-three-text |
3D text rendering in Three.js scenes |