import React from "react";
import PropTypes from "prop-types";
const MyComponent = (props) => {
return (
<p>"Item: "{props.id}" - "{props.title}</p>
);
};
MyComponent.propTypes = {
id: PropTypes.number,
title: PropTypes.string
};
MyComponent.defaultProps = {
id: 1,
title: "Título del ítem"
};
export default MyComponent;
Last active
January 30, 2023 14:55
-
-
Save hchocobar/58a086f71774e91cd1174e2a38483a1b to your computer and use it in GitHub Desktop.
React - 02 - Proptypes & defaultProps
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment