ericclemmons / ericclemmons/react-resolver

Resolve multiple props with one callback

Open
#98 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.6k
Forks
52
PR merge metrics
No merged PRs in 30d

Description

I got into this situation where my React component requires more than one prop.
One way to solve it was through adding two `@resolve` calls with two different callbacks.

`@resolve("propA", function() { remoteCall() .... return response.propA; })`
`@resolve("propB", function() { remoteCall().... return response.propB; })`

However, I'd like to be able to collect multiple props in one single callback, and hence save one remote call.

I hacked something together that allows me to do something like:

``` js
@resolve("{propA, propB}", function() {
remoteCall() ...
return { response.propA, response.propB };
})
```
- Does this make sense?
- Is there any other way to do this?
- Does this go against react-resolver's philosophy?

@ericclemmons: I can put together a Pull Request if you think this makes sense.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.