Carlos de la Orden
Sep 8, 2018 · 1 min read

Hi João Guilherme Menezes, two things:

1 — you shouldn’t decorate in your render method, do it outside your class, when you import the component. I think creating a new component “class” for every render is messing with the update. Move the decoration outside of render and use directly <InputWithFormField />.

2 — I don’t see the point of your decorator, because you’re simply passing props as they come, without renaming. If you’re only renaming one (the errorText), then you can destructure and pass the rest along:

mapProps(({error, ...rest}) => ({ errorText: error, ...rest }))

Or in this case, it would be better to simply use renameProp. https://github.com/acdlite/recompose/blob/master/docs/API.md#renameprop

My example was to keep the details of the redux-form library out of my presentational input (flattening the input and meta fields the library uses into top-level properties, not simply renaming!).

I hope this helps. :)

    Carlos de la Orden

    Written by

    Web coding since 2001