mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
21 lines
436 B
JavaScript
21 lines
436 B
JavaScript
import { useContext, Component } from 'react';
|
|
import { MyContext } from './react-create-context';
|
|
|
|
function useMyContext() {
|
|
return useContext(MyContext);
|
|
}
|
|
|
|
export function useDoc1() {
|
|
let { root } = useMyContext();
|
|
root.appendChild(window.name); // NOT OK
|
|
}
|
|
|
|
class C extends Component {
|
|
foo() {
|
|
let { root } = this.context;
|
|
root.appendChild(window.name); // NOT OK
|
|
}
|
|
}
|
|
|
|
C.contextType = MyContext;
|