From 9ead60e484e09c82cc67f10947b86a9cc9f41794 Mon Sep 17 00:00:00 2001 From: cesare soldini Date: Fri, 14 Jan 2022 19:40:36 +0100 Subject: [PATCH] [docs] add more details about "Use component bindings sparingly" --- .../tutorial/06-bindings/13-component-bindings/text.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/content/tutorial/06-bindings/13-component-bindings/text.md b/site/content/tutorial/06-bindings/13-component-bindings/text.md index 9ab1be29cd..141240633f 100644 --- a/site/content/tutorial/06-bindings/13-component-bindings/text.md +++ b/site/content/tutorial/06-bindings/13-component-bindings/text.md @@ -10,4 +10,6 @@ Just as you can bind to properties of DOM elements, you can bind to component pr Now, when the user interacts with the keypad, the value of `pin` in the parent component is immediately updated. -> Use component bindings sparingly. It can be difficult to track the flow of data around your application if you have too many of them, especially if there is no 'single source of truth'. \ No newline at end of file +> Use component bindings sparingly. It can be difficult to track the flow of data around your application if you have too many of them, especially if there is no "single source of truth". +> +> In this particular case, a better approach would be: the Keypad component could dispatch events for every numerical key, and it could be responsibility of the parent to concatenate the entire pin in a `let pin` variable, making it a single source of truth. This would make the Keypad component more generic and reusable.