Trying to Conditionally Render SVG's in a Custom React Select Component

15 Views Asked by At

Good Morning,

I am currently trying to render a custom dropdown indicator in a React Select Component - either down or up, based on whether or not the menu is open.

The custom component:

const CustomDropdownIndicator = (props, state) => {
        return (
        <components.DropdownIndicator {...props}>
            {state.selectProps.menuIsOpen ? <img src={dropDownImageSVG180} alt="Dropdown Indicator" /> : <img src={dropDownImageSVG} alt="Dropdown Indicator" />}
        </components.DropdownIndicator>
        );
    };

This isn't seeming to work though.

Does anyone have a solution?

Thanks a lot,

Jake

0

There are 0 best solutions below