
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@jam3/react-check-extra-props
Advanced tools
React runtime library to detect extra properties passed to components
React runtime library to detect extra properties passed to components.
This library will alert you about the properties we are passing to the components that we are not expecting. In case those extra properties are because deprecated code, removing them will give a bit of boost and cleanness to your React components.
npm install @jam3/react-check-extra-props
import checkProps from '@jam3/react-check-extra-props';
Wrap your propTypes object with the checking function and it will flag in the console all the extra properties we are sending to this object.
import React from 'react';
import PropTypes from 'prop-types';
import checkProps from '@jam3/react-check-extra-props';
class ExampleComponent extends React.Component {
render() {
// render function code
}
}
ExampleComponent.propTypes = checkProps({
type: PropTypes.string,
title: PropTypes.string,
description: PropTypes.string,
className: PropTypes.string,
isOpen: PropTypes.bool
});
ExampleComponent.defaultProps = {
isOpen: false
};
export default ExampleComponent;
In case you don't want to define in propTypes all the properties and you don't want the library to flag them as extra properties you can ignore them. To ignore them, send a second argument to the function. This argument is an array with property names.
...
const propsToIgnore = ['ref', 'data', 'ql'];
ExampleComponent.propTypes = checkProps({
type: PropTypes.string,
title: PropTypes.string,
description: PropTypes.string,
className: PropTypes.string,
isOpen: PropTypes.bool
}, propsToIgnore);
...
FAQs
React runtime library to detect extra properties passed to components
We found that @jam3/react-check-extra-props demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.