React Admin - Get current value in a form

前端 未结 2 2155
甜味超标
甜味超标 2021-02-20 08:02

I am having big troubles getting the \"updated\" value of a record in an edit form. I always get the initial record values, even though I have an input linked to the right recor

2条回答
  •  春和景丽
    2021-02-20 08:33

    I found a working solution :

    import { connect } from 'react-redux';
    
    const mapStateToProps = state => ({
        recordLiveValues: state.form['record-form'].values
    });
    
    export default connect(mapStateToProps)(MyForm);
    

    When mapping the form state to my component's properties, I'm able to find my values using :

    recordLiveValues.surface
    

提交回复
热议问题