public componentDidMount()

in adapters/react/RuiExpandCollapseReact/src/RuiExpandCollapse.tsx [77:94]


	public componentDidMount(): void {
		/**
		 * If user is controlling component then update the change handler
		 * on the element
		 *
		 * NB: FIXME when https://github.com/facebook/react/issues/15830 resolved
		 */
		if (this.props.onChange) {
			/**
			 * To set change handler on web component we need to overwrite the
			 * default change handler via a ref to the component
			 */
			const el: IHTMLRuiExpandCollapseElement | null = this.ruiExpandCollapseEl.current;
			if (el) {
				el.onExpandCollapse = this.props.onChange;
			}
		}
	}