Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Provider Api #4

Closed
gnoff opened this issue Aug 18, 2015 · 2 comments
Closed

New Provider Api #4

gnoff opened this issue Aug 18, 2015 · 2 comments

Comments

@gnoff
Copy link
Owner

gnoff commented Aug 18, 2015

remove configuration props {forwardProvided, allowOverload}
Stop auto-providing arbitrary props on Provider

add new Provider prop: provide: (parentProvided) => provided | plainObject

if provide is a function it receives the the provided in context (only makes sense if this Provider is nested) and returns an object to be provided. It would be up to the caller to forward some/all/no parent provided values.

if the Provider is top level then parentProvided will be undefined

if provide is an object then that object will be provided in this provider. This means that to forward props from parent providers you must do so explicitly

Questions

  1. should provided forwarding happen by default?
@gnoff
Copy link
Owner Author

gnoff commented Aug 20, 2015

New API

Provider

<Provider provide={mapProvided | plainObject}>
provide = mapProvided([parentProvided])
mapProvided = (parentProvided) => {
   //... any logic, parentProvided could be undefined
  return {...anything};
}
provide = plainObject

Provider wraps plainObject in defaultMapProvided

defaultMapProvided = (parentProvided) => ({...parentProvided, ...plainObject})

ObjectMode auto forwards provided values and allows overloading

@gnoff
Copy link
Owner Author

gnoff commented Aug 25, 2015

Implemented in v0.1.0 aec29d8

@gnoff gnoff closed this as completed Aug 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant