2
One of the main advantages I understood in using Vue.js/React is to define a component and be able to reuse it where necessary. Taking this into account, I have a web application that several times I have to put a html to make a button on the screen. Example:
<button type="button" class="btn btn-primary">Excluir</button>
As I repeat this button several times, I thought of creating a jam, example <btn-excluir></btn-excluir>
so I can reuse it every time. Except I don’t see any gain in componentizing it, I can write the html every time.
I can only see some gain in componentizing something, when this component has some reactive effect, some rule and etc.
Then I got this doubt, I must compose all html that repeats or I better compose only html that has something more complex, like reactivity, some ajax and etc ?
reuse also has a maintenance factor. Imagine you, if this button has an icon and you need to change, if it is written in component, changes the component, changes everywhere that this component exists, if it is not made component you have to change on all screens. Besides the organization I also think important for maintenance.
– novic
Maybe related: https://answall.com/questions/120931/o-dry-%C3%A9-to-avoid-redund%C3%a2ncias-certo/120932#120932
– Luiz Felipe
If you compose everything, how will you treat the exceptions? In the end you will have as many components as HTML code.... In my view componentizing everything is far from being a good option, just as minifying HTML code tb is not a good practice
– hugocsl