Skip to content

Instantly share code, notes, and snippets.

@nodox
Last active July 1, 2018 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nodox/3b73844813c1d72fc3051488e8694cfb to your computer and use it in GitHub Desktop.
Save nodox/3b73844813c1d72fc3051488e8694cfb to your computer and use it in GitHub Desktop.
Building a stepper - buttons.js
import React from "react";
class Next extends React.Component {
render() {
const { isActive } = this.props;
if (isActive === false) return null;
return (
<button onClick={() => this.props.goToNextStep()}>
Next
</button>
);
}
}
class Previous extends React.Component {
render() {
const { isActive } = this.props;
if (isActive === false) return null;
return (
<button onClick={() => this.props.goToPreviousStep()}>
Previous
</button>
);
}
}
class Submit extends React.Component {
render() {
const { isActive } = this.props;
if (isActive === false) return null;
return (
<button type="submit">
Submit
</button>
);
}
}
export { Previous, Next, Submit };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment