@atlaskit/onboarding
Version:
An onboarding spotlight introduces new features to users through focused messages or multi-step tours.
16 lines • 637 B
JavaScript
import React from 'react';
// This component was born from the pain of using render props in lifecycle methods.
// On update, it checks whether the current value prop is equal to the previous value prop.
// If they are different, it calls the onChange function.
// We use this for updating Popper when the SpotlightDialog width changes.
// eslint-disable-next-line @repo/internal/react/no-class-components
export default class ValueChanged extends React.Component {
componentDidUpdate(prevProps) {
if (prevProps.value !== this.props.value) {
this.props.onChange();
}
}
render() {
return this.props.children;
}
}