-
Notifications
You must be signed in to change notification settings - Fork 1.3k
add #renameProp, #renameProps and #withReducer examples #566
Conversation
Codecov Report
@@ Coverage Diff @@
## master #566 +/- ##
=======================================
Coverage 88.37% 88.37%
=======================================
Files 49 49
Lines 370 370
=======================================
Hits 327 327
Misses 43 43 Continue to review full report at Codecov.
|
I have nothing to say about reducer, but renameProps seems like useless hoc this days, Isnt it? With modern es6 syntax it can be written much more easily. Ma be we start to deprecate such hocs? |
@istarkov I agree, personally I never used it. I'm not sure how you see it with ES6 syntax but personally I would just use #mapProps for this purpose. I guess reason for #renameProps is to slightly reduce code and better describe intention of operation you do. Not sure if it's worth to keep one more method in API for this. and maybe do you have some comments on unit tests part? I saw you participated in few previous discussions about them? |
For unit testing here is what I’ve come up with: #407 (comment) |
@istarkov should I remove |
Sorry, I don't know now, let's think more. |
@istarkov sure, I also saw 2 issues regarding creating or updating documentation, will try to reach people responsible for them to get some insight of their work. |
I've never used |
@wuct are there any places in code I could look for such warning pattern? |
@pokorson No, there are not. We've not deprecated anything before. I've changed my mind and just adding some note in the doc which telling people to use |
docs/API.md
Outdated
``` | ||
renameProp('oldName', 'newName') | ||
-> | ||
mapProps(props => ({...props, newName: props.oldName})) |
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.
withProps
not mapProps
withProps(p => ({ newProp: p.oldProp }))
e6427d0
to
9afccc7
Compare
@istarkov fixed |
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.
We should follow the style guide. Please add spaces after {
and before }
.
e.g.
withProps(props => ({ newName: props.oldName }))
@wuct fixed |
hey @wuct I did |
@wuct another doc PR. I'm trying to introduce recompose to my team and they get a bit confuse about api description, what do you think about adding those examples?
Also it would be really nice to have some section about writing unit tests for components that uses recompose cause it gets a bit tricky. I'm still trying to wrap my head around how to write them. Should I create an issue to this discuss this further? Or is this something you discussed already?