This product is not supported for your selected
Datadog site. (
).
이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다.ID: jsx-react/no-deprecated
Language: JavaScript
Severity: Warning
Category: Error Prone
Description
As React evolves, methods are deprecated over time. This rule warns you about deprecated methods.
Non-Compliant Code Examples
React.render(<MyComponent />, root);
React.unmountComponentAtNode(root);
React.findDOMNode(this.refs.foo);
React.renderToString(<MyComponent />);
React.renderToStaticMarkup(<MyComponent />);
React.createClass({ /* Class object */ });
//Any factories under React.DOM
React.DOM.div();
import React, { PropTypes } from 'react';
// old lifecycles (since React 16.9)
componentWillMount() { }
componentWillReceiveProps() { }
componentWillUpdate() { }
// React 18 deprecations
import { render } from 'react-dom';
ReactDOM.render(<div></div>, container);
import { hydrate } from 'react-dom';
ReactDOM.hydrate(<div></div>, container);
import { unmountComponentAtNode } from 'react-dom';
ReactDOM.unmountComponentAtNode(container);
import { renderToNodeStream } from 'react-dom/server';
ReactDOMServer.renderToNodeStream(element);
Compliant Code Examples
import { PropTypes } from 'prop-types';
UNSAFE_componentWillMount() { }
UNSAFE_componentWillReceiveProps() { }
UNSAFE_componentWillUpdate() { }
ReactDOM.createPortal(child, container);
import { createRoot } from 'react-dom/client';
const root = createRoot(container);
root.unmount();
import { hydrateRoot } from 'react-dom/client';
const root = hydrateRoot(container, <App/>);
원활한 통합. Datadog Code Security를 경험해 보세요