Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
work with elements that have Ref's generated using the Hooks API (#1242)
* fix: work with elements that have Ref's generated using the Hooks API In the new Hooks API, Ref's no longer have to be functions, but can be simple objects with a `current` property. Instead of calling the Ref function, React sets `ref.current`. Currently, the following will throw an error: ```jsx const MyComponent = ({connectDragSource}) => { const ref = useRef(); return (<div ref={ref}/>); }; DragSource(type, spec, connect)(MyComponent); ``` There is ongoing work to provide a Hooks API for react-dnd, which will ultimately be preferrable, but this provides an immediate fix for mixing the current API with React Hooks. * refactor: add setref utility * feat: add react.createRef to FC simple example
- Loading branch information