geelen / react-snapshot

A zero-configuration static pre-renderer for React apps
MIT License
1.66k stars 104 forks source link

Doesn't work for dynamic redirects #106

Closed scratchyone closed 3 years ago

scratchyone commented 6 years ago

If you have dynamically generated redirects, react-snapshot doesn't know. I have code like this as my only way of getting around the site. You click a button, it checks some information, and then adds a redirect tag. if (!doc.authorized) { this.setState({ redirect: <Redirect to="/" /> }); }

scratchyone commented 6 years ago

You could maybe crawl src/index.js and look for redirect and link tags and crawl that.

FelixKuehl commented 6 years ago

Or you just force the rendering of this route in your reactSnapshot config in your package.json

"reactSnapshot": {
    "include": [
      "/foo"
    ]
  }