Zaid-Ajaj / Feliz

A fresh retake of the React API in Fable and a collection of high-quality components to build React applications in F#, optimized for happiness
https://zaid-ajaj.github.io/Feliz/
MIT License
544 stars 81 forks source link

Add examples of laying out components in multiple files #433

Closed nirvdrum closed 2 years ago

nirvdrum commented 2 years ago

The 3.16.0 version of Feliz.Template creates multiple components and stores them in a single Components.fs file. Given it's the default layout provided by the new project template, it suggests that all components should end up in this one file. If that's the case, it would be helpful to call that out in the docs since it's at odds with the layout in React with JS. Alternatively, if the best practice is to split components up into multiple files, it would be helpful to have the new project template do that instead to help convey the recommended project/disk layout.

MangelMaxime commented 2 years ago

I suppose in the example all the component are in a single file to make it less intimidating for newcomers.

However, it true that I don't think that this is viable for a "real" application as otherwise, you would end up with almost your whole client app code in a single file of thousands of lines.

Zaid-Ajaj commented 2 years ago

it suggests that all components should end up in this one file

Hi @nirvdrum, this is not the case! It is just to demonstrate how to create different components and use them from other components. Which convention you follow is up you. Personally, I prefer to put components that are logically related in one file rather then making the distinction of "big vs small" components

nirvdrum commented 2 years ago

Thanks for the clarification. My point was that as a new user, there isn't any guidance on the matter. Whether through documentation, a code generator, linter, or something else, it'd be helpful to see how a project should be organized beyond a single file.