mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 04:33:10 +00:00
20 lines
440 B
JavaScript
20 lines
440 B
JavaScript
import React from 'react';
|
|
// highlight-next-line
|
|
import polyfill from 'react-lifecycles-compat';
|
|
|
|
class ExampleComponent extends React.Component {
|
|
// highlight-next-line
|
|
static getDerivedStateFromProps(
|
|
nextProps,
|
|
prevState
|
|
) {
|
|
// Your state update logic here ...
|
|
}
|
|
}
|
|
|
|
// Polyfill your component to work with older versions of React:
|
|
// highlight-next-line
|
|
polyfill(ExampleComponent);
|
|
|
|
export default ExampleComponent;
|