Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import validator from './validator';
  2.  
  3. class Example {
  4.  
  5. constructor(props) {
  6. super(props)
  7. this.saveAndContinue = thos.saveAndContinue.bind(this)
  8. }
  9.  
  10. saveAndContinue () {
  11. var valid = validator.validate(this.props.form)
  12. if (valid) {
  13. axios.post('/path')
  14. <Redirect to='/other_tab'>
  15. } else {
  16. validator.showErrors()
  17. }
  18. }
  19.  
  20. render() {
  21. <button onClick={this.saveAndContinue}>Save and Continue</button>
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement