Home > Enterprise >  conditionnally render prop in html
conditionnally render prop in html

Time:09-14

Basically I am trying to set the closeModal prop when offline to true and else to closeModal. How do I achieve this ? I am using react-detect-offline and ant design.

        <Detector
                render={({ offline }) => (
                    <ModalSelectMenu
                    {offline ? closeModal = 'true' : closeModal = { closeModal }}
                        isModalVisible={isModalVisible}
                        history={history}   
                    />
                )}
            />

CodePudding user response:

try this

<ModalSelectMenu
  closeModal={offline ?'true' :  closeModal}
  isModalVisible={isModalVisible}
  history={history}   
 />
  • Related