Skip to content

Commit 41dd63a

Browse files
committed
Handle forwardRef in React
1 parent ce937e7 commit 41dd63a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

javascript/ql/lib/semmle/javascript/frameworks/React.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ private class ReactRouterLocationSource extends DOM::LocationSource::Range {
773773
private DataFlow::SourceNode higherOrderComponentBuilder() {
774774
// `memo(f)` returns a function that behaves as `f` but caches results
775775
// It is sometimes used to wrap an entire functional component.
776-
result = react().getAPropertyRead("memo")
776+
result = react().getAPropertyRead(["memo", "forwardRef"])
777777
or
778778
result = DataFlow::moduleMember("react-redux", "connect").getACall()
779779
or

javascript/ql/test/library-tests/frameworks/ReactJS/higherOrderComponent.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { memo } from 'react';
1+
import { memo, forwardRef } from 'react';
22
import { connect } from 'react-redux';
33
import { compose } from 'redux';
44
import styled from 'styled-components';
@@ -25,4 +25,4 @@ const ConnectedComponent = compose(withConnect, unknownFunction)(StyledComponent
2525

2626
const ConnectedComponent2 = withState('counter', 'setCounter', 0)(ConnectedComponent);
2727

28-
export default hot(module)(memo(ConnectedComponent2));
28+
export default hot(module)(memo(forwardRef(ConnectedComponent2)));

0 commit comments

Comments
 (0)