universal-react-redux-starter-kit
universal-react-redux-starter-kit copied to clipboard
Is there a way to wait for API response before server will render a page?
Hello! I found that server isn't waiting for async API response, and sends blank components to front-end.
Hi! I'll have a look at it soon, probably tomorrow.
What do you think about this approach? bananaoomarang/isomorphic-redux
The only confusing thing for me is adding a needs
array to each container.
I'll check it later in the weekend and come back to you. Thanks for the link.
I've checked it. It's a nice solution, I might implement it into this starter kit once I have some time. ;-)
also have the same question
@bodyno I think we could help @janoist1. Currently I'm working on integration redux-saga in this boilerplate, but I haven't much free time. Could you implement something like the example that I've posted above?
@kuatro I'm not so familiar with the universal react. Please tell me how to call dispatch action at server side.
It looks like I'll have some time in the upcoming weekend, will try to implement an async example and do some general updates. ;)
:+1: :+1: :+1:
@janoist1 Please just give me some train of thought how to call dispatch action at server side
@bodyno I'm not sure what you wanna achieve but guessing you want a point where you can initiate your (async) API request. I chose route onEnter
callback as starting point:
import Weather from './containers/WeatherContainer'
import { fetchWeatherData } from './modules/weather'
export default store => ({
path: 'weather',
component: Weather,
onEnter: () => {
// async get weather data
store.dispatch(fetchWeatherData())
}
})
I'm working on an async example that runs on server side. I'm not far from getting it done. ;-)
@kuatro if you can show me exactly what needs to be done, I'm personally interested in fixing this and don't mind submitting a PR to make it happen
Hey, @peterpme . As I understood, when you build an isomorphic React/Redux app, you need to implement your own promise middleware to resolve all API requests on server-side. I've sent a link above: bananaoomarang/isomorphic-redux
@janoist1 mind closing out this issue and direct folks to #19?