Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support props check #1444

Merged
merged 2 commits into from
Oct 25, 2019
Merged

feat: support props check #1444

merged 2 commits into from
Oct 25, 2019

Conversation

yuanyan
Copy link
Collaborator

@yuanyan yuanyan commented Oct 24, 2019

import PropTypes from 'prop-types';

const Link = ({ active, children, onClick }) => (
  <button
    onClick={onClick}
    disabled={active}
    style={{
      marginLeft: '4px',
    }}
  >
    {children}
  </button>
);

Link.propTypes = {
  active: PropTypes.bool.isRequired,
  children: PropTypes.node.isRequired,
  onClick: PropTypes.func.isRequired
};

render(<Link active={true}>Hello World</Link>);

And will print warning in console:

Warning: Failed prop type: The prop `onClick` is marked as required in `Link`, but its value is `undefined`.

@yuanyan yuanyan requested a review from chenjun1011 October 25, 2019 10:08
@yuanyan yuanyan merged commit 20c786a into master Oct 25, 2019
@delete-merged-branch delete-merged-branch bot deleted the rax-prop-types branch October 25, 2019 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants