Why is mixing HTML into your code in React good? Because it isolates all the view code for a single component in a single file.
Why is mixing HTML into your code in React good? Because it isolates all the view code for a single component in a single file.
1. If PHP coders did component driven development it might not be so bad, the problem is most PHP apps mix code and HTML in a way that resembles speggeti so we (I've tought a lot of PHP courses) teach separation of concerns as to encourage maintainable code.
2. In React you're not really supposed to (as a matter of best practice) mix presentation and business logic. Typically most components are for presentation only with business logic done via event handlers and props. If you need state you should wrap your display component in a business logic component (typically called a container in the Redux world).
> An Application
" Using props and state, we can put together a small Todo application. This example uses state to track the current list of items as well as the text that the user has entered. Although event handlers appear to be rendered inline, they will be collected and implemented using event delegation. "
The gist being that React is what happens when a PHP shop creates a client-side framework, with all the architectural warts that this might imply, if you're on the PHP-lowers-the-bar-to-web-programming-too-far bandwagon.
(FB engineers would probably tell you that their variant, Hack, is a far cry from PHP, and their coding standards are well above that of your bargain-basement wordpress drudge, but you get the idea)