How to fix React 15.5.3 PropTypes obsolete warning when using a reaction-transition group

guys! Someone got "Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead." using the React 15.5.3 "react-transition-group/CSSTransitionGroup" on "react-transition-group/CSSTransitionGroup" .

It looks like this addon is using older PropTypes. Does anyone know how to avoid this warning for this add-on?

+5
source share
2 answers

This error was fixed automatically when I updated the reaction-transition group to the latest version. It looks like the npm package now runs on PropTypes from "prop-types".

+1
source

It is deprecated after React version 15.5. Therefore, you need to install it separately.,
Install: npm install prop-types

 import React from 'react'; import PropTypes from 'prop-types'; class Component extends React.Component { render() { return <div>{this.props.text}</div>; } } Component.propTypes = { text: PropTypes.string.isRequired, }; 

Change You need to get an updated add-in package compatible with the latest latest updates. This package has not yet been updated, you can make changes to it ypurself.

+1
source

Source: https://habr.com/ru/post/1266551/


All Articles