Allow GoogleApiWrapper() HOC to be initialized with data from props#172
Merged
auser merged 3 commits intoApr 7, 2018
Merged
Conversation
Contributor
|
I <3 this feature! Can you add a bit to the README describing this? |
added 2 commits
March 29, 2018 23:34
…nctions-as-input # Conflicts: # README.md # src/GoogleApiComponent.js
Contributor
Author
|
Absolutely. I added the simple example of the alternative configuration to the README. Also noticed I had based my branch on an old version of master. It should be free of conflicts now. Edit: Oh well no wonder I was based on an old version - you pushed like 700 commits today ;) |
rangoo94
reviewed
Apr 4, 2018
| class Wrapper extends React.Component { | ||
| constructor(props, context) { | ||
| super(props, context); | ||
| const options = typeof input === 'function' ? input(props) : input; |
Contributor
There was a problem hiding this comment.
Nice idea, but I think that it's worth to rebuild it on props change as well. What do you think?
Contributor
There was a problem hiding this comment.
No problem, I will do it today.
rangoo94
added a commit
to rangoo94/google-maps-react
that referenced
this pull request
Apr 6, 2018
rangoo94
added a commit
to rangoo94/google-maps-react
that referenced
this pull request
Apr 6, 2018
rangoo94
added a commit
to rangoo94/google-maps-react
that referenced
this pull request
Apr 6, 2018
rangoo94
added a commit
to rangoo94/google-maps-react
that referenced
this pull request
Apr 6, 2018
rangoo94
added a commit
to rangoo94/google-maps-react
that referenced
this pull request
Apr 6, 2018
rangoo94
added a commit
to rangoo94/google-maps-react
that referenced
this pull request
Apr 6, 2018
auser
added a commit
that referenced
this pull request
Apr 7, 2018
#172 improvement: Allow Google HOC to be initialized from props
Contributor
Author
|
Thank you very much @rangoo94. My approach was indeed not complete. |
Contributor
|
No problem, you're welcome :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull requests enhances the GoogleApiWrapper HOC by the possibility to initialize it with data from props by accepting a function as argument when initializing the HOC. The function will be called by the HOC by passing it the props passed to the HOC.
This solution inspired by the recompose bundle (e.g. the HOC withProps()) and is completely backwards compatible.
With this change, the GoogleApiWrapper can be used the same way as before:
Additionally it can be initialized with a function as described above:
Or, as in our case, the HOC can be used with redux and recompose: