react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

Mention about recursion in choosing-the-state-structure.md

Open kaushalyap opened this issue 3 years ago • 5 comments
trafficstars

You can nest state as much as you like, but making it “flat” can solve numerous problems.

It can be confusing for users without proper background to understand how infinite nesting is achieved. So I suggest mentioning recursion and linking into MDN glossary might be worth it.

kaushalyap avatar Sep 01 '22 09:09 kaushalyap

Size Changes

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/learn/choosing-the-state-structure 60.64 KB (🟡 +36 B) 143.29 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

github-actions[bot] avatar Sep 01 '22 09:09 github-actions[bot]

I’m not sure this article really helps explain how it works.

gaearon avatar Sep 01 '22 10:09 gaearon

@gaearon What do you think about https://javascript.info/recursion? I referenced MDN since it is the most part of the docs refers to.

kaushalyap avatar Sep 01 '22 11:09 kaushalyap

I feel like it’s hard to make a connection from reading about JS recursion to recursion in rendering / JSX. We could be more explicit about it but I think a link alone isn’t enough to help.

gaearon avatar Sep 01 '22 12:09 gaearon

@gaearon IMHO I do not think adding something like “React components are also functions” will fit the context there, and it will also drive the reader away from the current topic at hand. I think it is best to put in a glossary page like MDN?

kaushalyap avatar Sep 01 '22 12:09 kaushalyap