2017-07-11 5 views
0

を提出しますインデックスはユーザーのためだけに読み込まれており、divを使用してレンダリングしています。フォームの提出中にインデックスの値を取得する方法。 MyCustomコンポーネントの外観はどうですか?Reduxの形式は不変私はシンプルなToDoリストをやろうとしています、不変Reduxの形式を使用しています、私はTODO項目のFieldArrayを使用しています、フォームが送信されると</p> <p>、私は値を取得していないすべてのフィールド

<TableRow selectable={false} key={index}> 
    <TableRowColumn style={styles.item}> 
     <Field name={`${todo}.index`} component={MyCustom} val={index + 1} /> 
    </TableRowColumn> 
    <TableRowColumn style={styles.done}> 
     <Field name={`${todo}.done`} component={CheckBox} label=""/> 
    </TableRowColumn> 
    <TableRowColumn style={styles.description}> 
     <Field name={`${todo}.description`} component={Text}/> 
    </TableRowColumn> 
    <TableRowColumn style={styles.duration}> 
     <Field name={`${todo}.duration`} component={Duration} type="number" normalize={integer}/> 
    </TableRowColumn> 
    <TableRowColumn style={styles.delete}> 
     {/* <button type="button" title="X" onClick={() => fields.remove(index)}>X</button> */} 
     <IconButton onClick={() => fields.remove(index)}> 
     <DeleteIcon/> 
     </IconButton> 
    </TableRowColumn> 
    </TableRow> 

MyCustom

<div> 
    <span>{val}</span> 
    </div> 
+0

コード例がない場合は、おそらく答えが得られません。 –

答えて

0

indexそれだけで価値だ、ここではフィールドではありません。だからそれを小道具として渡す。

+0

$ {todo} .descriptionが変更されると、フォームの送信中にそれを取得しますが、$ {todo} .indexフィールドを読み取り専用にして、送信中にその値を取得したいとします。 – Maru

関連する問題