DEV Community

Discussion on: Do We Really Need to Separate the Model from the UI?

 
mvila profile image
Manuel Vila

With your approach, don't you feel that your code ends up being unnecessarily scattered, and therefore, a bit difficult to maintain?

Thread Thread
 
johnkazer profile image
John Kazer

I don't create components in the React sense. I create a set of functions which manipulate the global state and a SPA Pug template (with mixins for modularity - but any HTML and CSS template approach would do). The functions can be grouped according to broad type (e.g. immediate actions, async effects, subscriptions to events...).

For me separation of concern is between business logic and appearance. Anything which is 'state' is controlled by functions, separately from HTML or CSS which are just expressions of state.

So I suppose at the end of the day I don't really agree with the implementation of React components. I try to re-use function and logic specifically rather than contained pieces of a website.