Skip to content

Commit b4ca13d

Browse files
committed
feat: add first .createRef() shim implementation
1 parent 340da5f commit b4ca13d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/shim/__story__/createRef.story.tsx

Whitespace-only changes.

src/shim/createRef.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const shimCreateRef = (React) => {
2+
if (typeof React.createRef !== 'function') {
3+
React.createRef = () => {
4+
const ref: any = (el) => {
5+
ref.value = el;
6+
};
7+
8+
return ref;
9+
};
10+
}
11+
};
12+
13+
export default shimCreateRef;

0 commit comments

Comments
 (0)