我想渲染多个<User/>
,<CustomForm/>
它们都是无状态组件。但是,如果我尝试修改其中一个,<CustomForm />
其他的<CustomForm/ >
也会被修改,因为它们都共享来自商店的相同属性。我怎样才能有多个独立的<CustomForm />
?
<User>
<CustomForm user_id={user_id} />
</User>
<User>
<CustomForm user_id={user_id}/>
</User>
我已经连接了这样的表格:
let CustomForm = (props) => {
const { fields: {author, content}, handleSubmit } = props;
return (
<form action="">
....
</form>
)
}
CustomForm = reduxForm({
form: `comment`, // I can't access props, i thought something like `comment_${props.user_id}`
fields: ['author', 'content']
})(CustomForm)
export default CustomForm;