This repository has been archived by the owner on Sep 10, 2022. It is now read-only.
default third argument of branch to identity function #227
Merged
Conversation
This file contains 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
@@ -34,3 +34,18 @@ test('branch tests props and applies one of two HoCs, for true and false', t => | |||
t.is(getIsBad(), 'true') | |||
t.is(getName(), 'Heisenberg') | |||
}) | |||
|
|||
test.only('branch defaults third argument to identity function', t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove only, please :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@acdlite 🙈 sorry, removed
const branch = ( | ||
test, | ||
left, | ||
right = baseComponent => baseComponent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit hard to read. Could you define identity
above and use that instead?
Nice, thanks! |
Great that this got merged (it's a change I also wanted to ask for), but when will a new version of recompose be published to npm? |
istarkov
pushed a commit
that referenced
this pull request
Oct 31, 2016
* Fix mapPropsStream's example It seems like in the docs, `Observable` refers to `Rx.Observable`. In Rx4 and Rx5, `Rx.Observable.interval` emits numbers, not objects. * Advertise `withProps` * Clean-up some comments * Fix links to the React documentation * Improve renderComponent's doc Since faaafb0 (#227), branch's third argument defaults to the identity function. This is a nice addition and we probably want to advertise it in renderComponent's doc. * Remove dead code Since 390697a (#180, 2016-05-21), branch()'s `{Left,Right}Component` internal instance variables are not used anymore.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
closes #226