mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
[hoisting] Add more repros for hoisting bugs
This commit is contained in:
1 parent
dca54c8932
commit
4a793bb86e
4 files changed
+70
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Component(props) {
|
||||
const wat = () => {
|
||||
const pathname = "wat";
|
||||
pathname;
|
||||
};
|
||||
|
||||
const pathname = props.wat;
|
||||
const deeplinkItemId = pathname ? itemID : null;
|
||||
|
||||
return <button onClick={() => wat()}>{deeplinkItemId}</button>;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] Invariant: Expected value kind to be initialized at '8:25:8:33' (8:8)
|
||||
```
|
||||
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
function Component(props) {
|
||||
const wat = () => {
|
||||
const pathname = "wat";
|
||||
pathname;
|
||||
};
|
||||
|
||||
const pathname = props.wat;
|
||||
const deeplinkItemId = pathname ? itemID : null;
|
||||
|
||||
return <button onClick={() => wat()}>{deeplinkItemId}</button>;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Component() {
|
||||
useRunOnceDuringRender(() => {
|
||||
const handler = () => {
|
||||
return () => {
|
||||
detachHandler(handler);
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] Todo: EnterSSA: Expected identifier to be defined before being used. Identifier handler$1 is undefined (3:7)
|
||||
```
|
||||
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
function Component() {
|
||||
useRunOnceDuringRender(() => {
|
||||
const handler = () => {
|
||||
return () => {
|
||||
detachHandler(handler);
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user