![]() ![]() For this example, it is a part of ProductTable because it appears inside the ProductTable’s list. This is a matter of preference, and you could go either way. If you look at ProductTable (lavender), you’ll see that the table header (containing the “Name” and “Price” labels) isn’t its own component. There are five components on this screen: Separate your UI into components, where each component matches one piece of your data model. That’s because UI and data models often have the same information architecture-that is, the same shape. If your JSON is well-structured, you’ll often find that it naturally maps to the component structure of your UI. Design-consider how you would organize the design’s layers.(However, components are a bit less granular.) CSS-consider what you would make class selectors for.If it ends up growing, it should be decomposed into smaller subcomponents. One such technique is the single responsibility principle, that is, a component should ideally only do one thing. Programming-use the same techniques for deciding if you should create a new function or object.Ask them!ĭepending on your background, you can think about splitting up a design into components in different ways: If you work with a designer, they may have already named these components in their design tool. Start by drawing boxes around every component and subcomponent in the mockup and naming them. Step 1: Break the UI into a component hierarchy To implement a UI in React, you will usually follow the same five steps. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |