Skip to content

Instantly share code, notes, and snippets.

@mrcthms
Created August 17, 2017 08:17
Show Gist options
  • Save mrcthms/609145abff73a9fb6f6429c926b45df4 to your computer and use it in GitHub Desktop.
Save mrcthms/609145abff73a9fb6f6429c926b45df4 to your computer and use it in GitHub Desktop.
import React from 'react';
import PropTypes from 'prop-types';
export const oneOfProps = {
colour: ['red', 'green', 'blue'],
size: ['small', 'medium', 'large']
};
export const propTypes = {
name: PropTypes.string.isRequired,
colour: PropTypes.oneOf(oneOfProps[colour]).isRequired,
size: PropTypes.oneOf(oneOfProps[size])
};
export const Component = () => <div>Hello World</div>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment