async-props icon indicating copy to clipboard operation
async-props copied to clipboard

Is the loadPropsOnServer example up-to-date?

Open fetimo opened this issue 9 years ago • 4 comments

I tried following the server example in README.md but got the error cb is not a function. After looking at loadPropsOnServer it looks like it's expecting 3 arguments where the last is the callback whereas the example has 2 unless I'm missing something?

What should be passed as the second argument, loadContext?

Other than that this library solves a much needed problem so thanks very much :)

fetimo avatar Apr 14 '16 14:04 fetimo

put null as the second argument if you don't want to pass loadContext. So yes, context is there

zackify avatar Apr 14 '16 14:04 zackify

Thanks @zackify .

Sorry, just realised that there's already a PR for this https://github.com/ryanflorence/async-props/pull/60.

What would the loadContext be used for if it was passed? Populating components' contexts?

fetimo avatar Apr 14 '16 15:04 fetimo

Say you have some stuff you want loadProps to know about. Like the request IP address. You can pass that in to loadProps and have access to it. Or possibly a cookie. Can't think of a better example right now. On Thu, Apr 14, 2016 at 11:03 Tim [email protected] wrote:

Thanks @zackify https://github.com/zackify .

Sorry, just realised that there's already a PR for this #60 https://github.com/ryanflorence/async-props/pull/60.

What would the loadContext be used for if it was passed? Populating components' contexts?

— You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub https://github.com/ryanflorence/async-props/issues/63#issuecomment-209988704

zackify avatar Apr 14 '16 15:04 zackify

That makes sense, thanks for the clarification.

fetimo avatar Apr 14 '16 15:04 fetimo