I had button in app.js
and i wanna using event onSubmit from another function. But, when I'm trying it - nothing happens.
App.js
import React, { Component } from 'react';
import Publish from './Publish';
class App extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<form onSubmit={Publish.onSubmit}>
<button></button>
</form>
</div>
);
}
}
export default App;
Publish.js
import React, { Component } from 'react';
import web3 from './web3';
import auth from './multiauth';
class Publish extends Component {
constructor(props){
super(props);
this.state = {
// some data
};
}
componentDidMount(){
fetch('url')
.then(res => res.json())
.then(json => {
this.setState({
//some data
})
})
}
onSubmit = async (event)=>{
//some functional
}
export default Publish;
When Publish function onSubmit
was in App it worked. But now, when I push the button nothing happens.
How can i fix it?