Skip to content

Remove react-router dependency#35

Merged
ProLoser merged 1 commit into
mainfrom
copilot/remove-react-router
Jun 9, 2026
Merged

Remove react-router dependency#35
ProLoser merged 1 commit into
mainfrom
copilot/remove-react-router

Conversation

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Removes react-router entirely (both the CDN script and the npm dependency) in favor of minimal native hash-based routing.

Changes

  • script.jsx

    • Added getHashParams() to parse window.location.hash into { scriptId, action }
    • Dropped ReactRouter.State mixin from Script, Line, and Nav; replaced all this.getParams() calls with getHashParams()
    • Replaced <Link to="/demo"> with <a href="#/demo">
    • Replaced ReactRouter.run() + Route/DefaultRoute/RouteHandler bootstrap with a simple App component rendered on hashchange
    function getHashParams() {
      var hash = window.location.hash.replace(/^#\/?/, '');
      var parts = hash ? hash.split('/') : [];
      return { scriptId: parts[0] || null, action: parts[1] || null };
    }
    
    window.addEventListener('hashchange', renderApp);
    renderApp();
  • index.html — removed react-router@0.11.6 CDN <script> tag

  • package.json — removed "react-router": "^7.13.0" from dependencies

@ProLoser ProLoser marked this pull request as ready for review June 9, 2026 21:28
@ProLoser ProLoser merged commit 0a32392 into main Jun 9, 2026
@ProLoser ProLoser deleted the copilot/remove-react-router branch June 9, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants