-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Prune list of helpers #124
Comments
Without |
BTW I'm not using |
|
My thinking is that both |
+1 for |
@RafalFilipek Yes, or something like rx-recompose's |
@acdlite actually you're right, it's not that useful, at least for me, I thought I remembered two times I had used it but going back to find them I now realise that
|
@acdlite wrote I think It can't be replaced normal. Because:
IMHO For example for my
as there are a lot of computationally intensive tasks for chart data, which can be split in a lot of small operations. Or here is live example https://github.com/istarkov/google-map-clustering-example/blob/master/src/GMap.js
|
Regarding // This is a higher-order component that expects a `fullName` prop
const someHoc = ComposedComponent => props => {
// Do something with props.fullName
};
// Person.js
const Person = props => <div>{props.fullName}</div>;
export default compose(
withAttachedProps(getProps => {
const { firstName, lastName } = getProps();
return { fullName: `${firstName} ${lastName}` };
}),
someHoc
)(Person)
// Later...
<Person firstName='Tom' lastName='Cruise' /> So I needed to compute props in order to provide new props to a child component, but I knew that I only needed to compute those props once. Would there be a better way to do this with one of the other helpers? Or perhaps is this just a bad idea all around? |
@npbee I believe that's what the original idea behind |
@nfcampos I've thought about adding something like your |
@acdlite I think i'll end up doing something like that |
I liked doOnReceiveProps was pretty helpful. only one thing that could make it better is to pass oldProps as second argument.
to
basically removing need to create a class entirely. It is pretty handy with redux and multiple parts of store required. They not always as easy to describe with one promise since status can change by different actions such as sockets message |
Sorry to discover about dropping doOnReceiveProps – I used it in a few places when I needed some components to fetch missing pieces of data both on mount and update. Using this saves LOCs. In fact I used |
I'm not opposed to bringing back |
One of most common use case for me for As a simple example, I save on the server every component The other use cases are similar, except where I need to call some external action. So for most of my use-cases |
PS: Looks like a lot of my current |
@istarkov |
As we start thinking about a 1.0 release, I want to drop any helpers that haven't worked out or are out of scope. Let's use this issue to keep track of which ones are on the chopping block:
withAttachedProps
— will be replaced bywithHandlers
(I'll have PR ready for this soonadded in 0.17)Keeping this and renaming tomapPropsOnChange
— not convinced this is actually useful. Can be replaced by normalmapProps
+ function memoization, via lodash or otherwise.withPropsOnChange()
mapPropsOnChange -> withPropsOnChange #134doOnReceiveProps
lifecycle
Update: there's some disagreement over whether the lifecycle-based helpers belong in the library or not. My attitude is that they're currently half-baked, so let's remove them for now and we can add them in a minor release once we've figured out a better story for them — or not, if we decide they're outside the scope of the library.
The text was updated successfully, but these errors were encountered: