Tengo un modal que se abrirá con las mismas entradas con diferentes botones. pero cuando escribo algo en la entrada y luego cierro el modal y luego lo abro nuevamente, los datos en la entrada todavía están en el modal. Estoy usando reaccionar redux para los valores de las entradas y para abrir y cerrar el modal. este es mi componente de entrada:
<FormControl className="content-select"> <Select name="phoneCallResultId" value={this.props.violations.phones?.form?.phoneCallResultId || ''} onChange={(e) => this.props.handleChangeForm(e)} displayEmpty defaultValue='' className="selectEmpty" inputProps={{ 'aria-label': 'Without label' }} > {(this.props.violations?.phones?.phoneCallResultsList || []).map((item, index) => { return ( <MenuItem className="select-title-value" key={index} value={item.id}>{item.name}</MenuItem> ) })} </Select> </FormControl>Y este es mi componente modal:
<DialogViolationContent title={this.props.violations.phones.mode != 'read' ? (this.props.violations.phones.mode == 'create') ? open={this.props.violations.phones.configPhoneModalInfo.open} handleClose={() => this.props.togglePhoneModalInfo()} aria-labelledby="responsive-dialog-title" className="modal-title" </div> //this is where the modal will close <Button className="cancel-info-btn" onClick={() => this.props.togglePhoneModalInfo()}> cancell </Button> </> }> <PhoneForm /> </DialogViolationContent>Y aquí está mi reductor:
case ViolationsConstants.TOGGLE_PHONE_INFO_MODAL: state.phones.configPhoneModalInfo.open = !state.phones.configPhoneModalInfo.open; return { ...state };Que mi estado inicial se establece en: abierto: falso
export const togglePhoneModalInfo = () => dispatch => dispatch({ type: ViolationsConstants.TOGGLE_PHONE_INFO_MODAL })