Is there a better way to validate if a number is inside a range?
Avoiding to write
PropTypes.oneOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
If it's a sequence, You can use a smart ES6. :)
[BTW, I believe the first answer is the most appreciate, this one is just trick]
PropTypes.oneOf([...(new Array(10))].map((_, i) => i + 1))
// Sequence
console.log([...(new Array(5))].map((_, i) => i + 1))
// Spreading the Sequence numbers
console.log(...[...(new Array(5))].map((_, i) => i + 1))