Build a Resizable Split Pane Component
Modern applications, from IDEs to dashboards, often require flexible layouts that allow users to customize their workspace. A common UI pattern for this is the "Split Pane," which enables users to dynamically resize adjacent content areas. This problem challenges you to build a robust and interactive SplitPane component, a fundamental building block for highly configurable user interfaces. Mastering this pattern demonstrates strong understanding of DOM manipulation, event handling, and responsive UI design in React.
Your primary task is to create a SplitPane React component that allows a user to resize two horizontal content areas by dragging a divider between them.
SplitPane.SplitPane component should accept two React.ReactNode children, leftPane and rightPane, and render them side-by-side.leftPane and rightPane.initialRatio prop (a number between 0 and 1) to set the initial width distribution of the panes. If not provided, default to 0.5 (50/50 split).minPaneWidth prop (a number in pixels) to prevent either pane from shrinking below a specified minimum width. If not provided, default to 100 pixels.ew-resize (east-west resize) to indicate it's draggable.SplitPane component should occupy 100% width and height of its parent container.SplitPane component renders two distinct content areas (left and right) and a divider between them.initialRatio prop correctly sets the initial width distribution of the panes.minPaneWidth value.ew-resize when hovering over the divider.Constraints
SplitPane component as a React functional component.react-split-pane, re-resizable). Build the core logic from scratch.SplitPane is assumed to have a defined width and height.minPaneWidth will be a positive integer.cursor changes (e.g., keyboard navigation for resizing).SplitPane component well-structured, reusable, and does it follow React best practices (e.g., prop types, state management, event handling)?Loading editor...