【发布时间】:2019-11-12 18:04:39
【问题描述】:
我现在对我的操作文件夹进行了操作,我想访问“发送新消息” 到我的 handleSubmit 函数 以下是我的操作代码:
export const types = {
MESSAGES: {
SYNC: 'MESSAGES.SYNC',
NEW: {
CHANGE: 'MESSAGES.NEW.CHANGE',
SEND: 'MESSAGES.NEW.SEND'
}
}
}
export const syncMessages = messages => ({
type: types.MESSAGES.SYNC,
messages
})
export const changeNewMessage = text => ({
type: types.MESSAGES.NEW.CHANGE,
text
})
export const sendNewMessage = () => ({
type: types.MESSAGES.NEW.SEND
})
现在我想在我的表单“handleSubmit”函数中访问它 下面是我的 message.jsx 文件代码
import React from 'react';
import SubMenu from './SubMenu';
import MessageForm from './form/MessageForm';
import * as action from "../../actions/messages.actions";
export default class Messages extends React.PureComponent {
handleSubmit = (e) => {
console.log(e.target.value)
}
render() {
return (
<section className="page-notifications">
<SubMenu/>
<MessageForm onSubmit={this.handleSubmit}/>
</section>
)
}
}
提前致谢
【问题讨论】:
标签: javascript reactjs redux