Comments (4)
@stereobooster sorry, was on vacation last week. You're right - there's no official support for SSR, but it's not all that hard to do. The way I've got it set up in my app is to make my main <App/>
component accept a route
prop. Then wrote a method that mimics the string -> route matching logic from the official router module (it's a straight copy/paste) and use that on the server to figure out the route based on req.path
, and pass it to my <App/>
. I'm a little busy catching up this week but if I find some time I'll try to make the needed changes here!
from reason-react-native-web-example.
@stereobooster I think I also ran into this when I tried out the example and discovered it had something to do with the way react-router was not getting at the context correctly, perhaps? In any case, I'm nearly certain the issue lies with react-router integration, not razzle. I think there may be some other good examples out there of correct RR usage w/ Reason if that's what you're shooting for.
It'd probably be a good idea to update this example to use the official ReasonReact router, now that it exists, as that's a more official approach and is more in line with what this example is supposed to be showing (integration with RNW/Reason/Razzle). @jaredpalmer any objection to that?
from reason-react-native-web-example.
@stereobooster go right ahead. Would love the update!
from reason-react-native-web-example.
It'd probably be a good idea to update this example to use the official ReasonReact router
But to do this we will need to change implementation of server.js
- write it in Reason? I'm not sure ReasonReact router supports SSR.
UPD: As far as I know ReasonReact router
doesn't support SSR. See https://github.com/reasonml/reason-react/blob/b332ebcb03e96bfc10a02dab4c397e2ca45867fb/lib/js/src/ReasonReact.js#L596-L619
Related: reasonml-community/reason-react-hacker-news#10
from reason-react-native-web-example.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reason-react-native-web-example.