mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Repro for "expect trees to be >=2 elements long" invariant
These cases have a switch with only a default, so we create a "conditional" child dependency tree and no other trees which hits the invariant.
This commit is contained in:
1 parent
ee93b62f51
commit
3229302222
2 files changed
+27
No files matched your search
+21
@@ -0,0 +1,21 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Component({ kind, ...props }) {
|
||||
switch (kind) {
|
||||
default:
|
||||
return <Stringify {...props} />;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] Invariant: Expected trees to be at least 2 elements long.
|
||||
```
|
||||
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
function Component({ kind, ...props }) {
|
||||
switch (kind) {
|
||||
default:
|
||||
return <Stringify {...props} />;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user