react-redux-form icon indicating copy to clipboard operation
react-redux-form copied to clipboard

Warnings when mapping bools with mapProps

Open MartinElvar opened this issue 6 years ago • 2 comments

The Problem

I'm mapping touched and focus to determine if i should put a prop on my Input component. But this is results in warnings, telling me that the prop should be a string.

Steps to Reproduce

Apply mapProps

Reproducible Code Example

https://codesandbox.io/s/ol5ky04o46 check console

MartinElvar avatar May 30 '18 08:05 MartinElvar

Do you know the fix, and would like to make a PR?

davidkpiano avatar May 30 '18 14:05 davidkpiano

Hello @davidkpiano,

Did some digging, and it would seem that this is enforced by react. Adding touched={ false } to a vanilla input field will yield the same result.

So i'm a bit unsure how to handle this, i could convert forth and back in my own application. Or this could be handled by react-redux-form, i would assume by casting certain boolean values to string, that react actually render to the dom. Could be somewhere in here https://github.com/davidkpiano/react-redux-form/blob/master/src/components/control-component-factory.js#L229.

I would love to make a pull request, if that is desired road. But would love some input.

Thank you :-).

MartinElvar avatar May 31 '18 08:05 MartinElvar