Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 142562

React switch in render: div children no styling

$
0
0

so in my render() function I have a switch to conditionally load different components based on a type, the problem is that for one of the cases I had to render 2 components, so I wrapped them in a div, by doing so they lose the class that was assigned to them inputField, this is how the code is looking:

{(() => {
                switch (values.type) {
                  case "sole":
                    return (
                      <div>
                        <InputMask
                          className={classNames(
                            styles.inputField,
                            styles.override
                          )}
                        >
                          {() => (
                            <LNTextField
                              type="text"
                            />
                          )}
                        </InputMask>
                        <InputMask
                          className={classNames(
                            styles.inputField,
                            styles.override
                          )}
                        >
                          {() => (
                            <LNTextField
                              name="dob"
                              type="text"
                            />
                          )}
                        </InputMask>
                      </div>
                    );
                  default:
                    return null;
                }
              })()}

I removed alot of the functional bits of the code since this is a styling issue, why are the InputMasks not having the inputField class applied now that they're in a div and how can I fix this?


Viewing all articles
Browse latest Browse all 142562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>