Skip to content

Commit

Permalink
Export InputSpinner via forwardRef
Browse files Browse the repository at this point in the history
This addresses the error: `Function components cannot be given refs.` that arises from using a ref with InputSpinner.
  • Loading branch information
arstropica authored Feb 16, 2023
1 parent 3752e39 commit b95cd8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import InputSpinner from "./InputSpinner";
import {getSkin} from "./Skins";

// Export
export default (props) => {
export default React.forwardRef((props, ref) => {
const skinProps = getSkin(props.skin, props);
const finalProps = {...props, ...skinProps};
return <InputSpinner {...finalProps} />;
};
return <InputSpinner {...finalProps} ref={ref} />;
});

0 comments on commit b95cd8c

Please sign in to comment.