Skip to content

Resolve multiple props with one callback #98

@nettofarah

Description

@nettofarah

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:

@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions