erikras / erikras/react-redux-universal-hot-example

Using route params in fetchData

Open
#609 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm trying to get data from database based on my path. There is no problem while using fetchDataDeferred, because function getState() return my route state with route params in it, but when I'm using fetchData router object is empty and I have no other idea how to get the data I need.

I assume that I'm doing something wrong and for instance I shouldn't get route params that way, but I haven't found any other way. :)

Also I can't just use fetchDataDeferred - I have to have results before initial rendering of my component - there are many nested objects and I don't want to make so many conditional statements if they exists, nor returning empty div if I haven't got data yet, 'cos as far as I'm concerned - that's why fetchData was created.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.