Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- import PropTypes from 'prop-types';
- const propTypes = {
- count: PropTypes.number.isRequired,
- onIncrement: PropTypes.func.isRequired,
- onDecrement: PropTypes.func.isRequired,
- };
- const Counter = ({ count, onIncrement, onDecrement }) => (
- <div>
- <span>{count}</span>
- <button onClick={onIncrement}>Increment</button>
- <button onClick={onDecrement}>Decrement</button>
- </div>
- );
- Counter.propTypes = propTypes;
- export default Counter;
Add Comment
Please, Sign In to add comment