Repro for fbt with unexpected child count

This commit is contained in:
Joe Savona
2024-03-13 14:54:35 -07:00
parent d5eca2ed85
commit bf64a826a4
2 changed files with 41 additions and 0 deletions
@@ -0,0 +1,31 @@
## Input
```javascript
function Component(props) {
return (
<fbt desc="Title">
<fbt:plural count={identity(props.count)} name="count" showCount="yes">
vote
</fbt:plural>{" "}
for <fbt:param name="option">{props.option} </fbt:param>
</fbt>
);
}
```
## Error
```
5 | vote
6 | </fbt:plural>{" "}
> 7 | for <fbt:param name="option">{props.option} </fbt:param>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ReactForget] Invariant: Expected fbt element to have 3 children (whitespace, content, whitespace) or 1 (content) (7:7)
8 | </fbt>
9 | );
10 | }
```
@@ -0,0 +1,10 @@
function Component(props) {
return (
<fbt desc="Title">
<fbt:plural count={identity(props.count)} name="count" showCount="yes">
vote
</fbt:plural>{" "}
for <fbt:param name="option">{props.option} </fbt:param>
</fbt>
);
}