我用的是Axios和React.js。我想在webservice响应之后调用一个函数。但它不起作用,这是我的代码:
public onValidateRenammeNature = () => { // bouton valider, renomme la nature
let id
let newName
console.log("this.state.myNature.id : " + this.state.myNature.id)
id = this.state.myNature.id
newName = this.refs.nature.get
我想问您如何在React.js中使用事件函数。
我想做一个测试函数,当点击titlesList时,它会得到索引和打印索引。但是这个函数在被点击的时候不起作用。
你能给我解决这个问题的建议吗?
const some = (props) = {
// 'props' have two attributes, titles and contents
// which each is a array of strings.
function test(index){
console.log('clicked');
我希望当单击yes按钮时,发送A请求并关闭模式。 我的关闭模式函数是props,我的axios请求是在函数内部。 如何在axios响应中调用props函数? 或者,当单击yes按钮时,我如何调用函数和props函数? function DeleteRow(props){
let {ErrorHandler} = useContext(ErrorContext);
let {DidUpdate} = useContext(AsideContext);
let data = `id=${props.status.rowId}`;
function DeleteRowReq(){
a
在我的登录页面中,我使用axios在单独的函数中向服务器发送响应,并使用回调在主login组件中设置Login组件状态。问题是,我得到了一个Uncaught (in promise) TypeError: Cannot read property 'status' of undefined。catch中的console.log向我显示TypeError: onSucceed is not a function (对于Status 200,onSucceed是回调函数)。但也会显示.then中的my console.log。搞什么鬼?我的回调真的错了吗? 我的请求函数: imp