Skip to content

Commit 030de09

Browse files
author
Eduardo Pelitti
authored
Modify duplicate code block in intro-react.md (facebook#2051)
There are two examples placed one on top of the other where the code is exactly the same. This makes the docs harder to understand, as referencing the same exact code for pointing out two different things in consecutive paragraphs can be confusing to a newcomer. It feels like a mistake, even though it can be backed that it is not. I suggest removing the `export default Cat;` from the first example, where introducing the concept of default exports is not necessary, and use it only on the second code block, where the complete function component is displayed and once the concept has been properly introduced in the previous paragraph. I think this makes more sense and avoids the duplicate.
1 parent 1e5e52f commit 030de09

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

‎docs/intro-react.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ Here the `Cat` component will render a `<Text>` element:
6666
const Cat = () => {
6767
return <Text>Hello, I am your cat!</Text>;
6868
};
69-
70-
export default Cat;
7169
```
7270

7371
You can export your function component with JavaScript’s [`export default`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) for use throughout your app like so:

0 commit comments

Comments
 (0)