-
-
Save mtunski/11a662814b488b97e434b9a4f073cce5 to your computer and use it in GitHub Desktop.
R_on_R => RR v4 + SSR = :(
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { Route, Switch } from "react-router-dom" | |
import PageNotFound from "routing/pages/PageNotFound" | |
import LandingPage from "./pages/LandingPage" | |
import LoginPage from "./pages/LoginPage" | |
import SignupPage from "./pages/SignupPage" | |
const Routes = () => | |
<Switch> | |
<Route exact path="/" component={LandingPage} /> | |
<Route exact path="/login" component={LoginPage} /> | |
<Route exact path="/signup" component={SignupPage} /> | |
<Route component={PageNotFound} /> | |
</Switch> | |
export default Routes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.routes.draw do | |
root to: "pages#marketing" | |
get "/platform", to: "pages#platform | |
get "/platform/*path", to: "pages#platform" | |
get "*path", to: "pages#marketing" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ReactOnRails from "react-on-rails" | |
import ServerApp from "./ServerApp" | |
ReactOnRails.register({ | |
MarketingApp: ServerApp, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { StaticRouter } from "react-router" | |
import Routes from "./Routes" | |
const ServerApp = ( | |
props, | |
railsContext, | |
) => | |
<StaticRouter | |
location={railsContext.location} | |
> | |
<Routes /> | |
</StaticRouter> | |
export default ServerApp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment