Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react using proptypes

import React from 'react';
import PropTypes from 'prop-types';

const Example = (props) => {
  return (
    <div>
      <p>Some prop: {props.some}</p>
      <p>Other prop: {props.other}</p>
    </div>
  );
};

Example.propTypes = {
  some: PropTypes.string.isRequired,
  other: PropTypes.number.isRequired
};

export default Example;
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #react #proptypes
ADD COMMENT
Topic
Name
8+3 =