You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ux.symfony.com/cookbook/component_architecture.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -15,8 +15,8 @@ In Symfony UX exist two packages: [TwigComponents](https://symfony.com/bundles/u
15
15
Those two packages allow you to create reusable components in your Symfony application.
16
16
But the component architecture is not exclusive to Symfony, it's a design pattern that can be applied to any programming language or framework.
17
17
And the Javascript world already implements this architecture for long time, on many different frameworks like React, Vue, or Svelte.
18
-
So, a set of rules and pattern has already be defined to work with components. This is why Symfony UX try to be as close as possible to those rules.
19
-
So let's see what are those rules!
18
+
So, a set of rules and patterns has already be defined to work with components. This is why Symfony UX tries to be as close as possible to those rules.
19
+
So, let's see what those rules are!
20
20
21
21
## 4 Rules
22
22
@@ -50,18 +50,18 @@ Or you can make composition with the following syntax:
50
50
</twig:Card>
51
51
```
52
52
53
-
So here we have a Card component, and we give to the content of this component two others components.
53
+
So here we have a Card component, and we give to the content of this component two other components.
54
54
55
55
### Independence
56
56
57
-
This is a really important rule, and not obvious. But your component should leave on his own context,
58
-
it should not be aware of the rest of the page. You should be able to take one component into a page, to another and it should works exactly the same.
59
-
This rule make your component truly reusable.
57
+
This is a really important rule, and not obvious. But your component should live on his own context,
58
+
it should not be aware of the rest of the page. You should be able to take a component into a page, from another and it should work exactly the same.
59
+
This rule makes your component truly reusable.
60
60
61
61
***How does it work into Symfony?***
62
62
63
63
Symfony keeps the context of the page into the context of your component. So this your own responsibility to follow those rules.
64
-
But notice that if there are conflicts between a variable from the context page and your component, your component context override the page context.
64
+
But notice that if there are conflicts between a variable from the context page and your component, your component context overrides the page context.
0 commit comments