This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
| import warning from 'warning'; | |
| let warned = {}; | |
| export default function deprecated(propType, explanation) { | |
| return function validate(props, propName, componentName) { | |
| if (props[propName] != null) { | |
| const message = `"${propName}" property of "${componentName}" has been deprecated.\n${explanation}`; | |
| if (!warned[message]) { | |
| warning(false, message); | |
| warned[message] = true; | |
| } | |
| } | |
| return propType(props, propName, componentName); | |
| }; | |
| } | |
| function _resetWarned() { | |
| warned = {}; | |
| } | |
| deprecated._resetWarned = _resetWarned; |