/** * WordPress dependencies */ import { ToggleControl } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { useContext } from '@wordpress/element'; /** * Internal dependencies */ import DataViewsContext from '../dataviews-context'; export default function InfiniteScrollToggle() { const context = useContext( DataViewsContext ); const { view, onChangeView } = context; const infiniteScrollEnabled = view.infiniteScrollEnabled ?? false; return ( { onChangeView( { ...view, infiniteScrollEnabled: newValue, } ); } } /> ); }