Similarly controls with state are a bad idea

For example - a “grid control” or a “tree control”

It becomes confusing where application state should live - there needs to be a single source of truth and the less duplication the better.

For instance if you write an application which needs to represent a file tree, then do it by:

  • Keep the state information in nested Javascript table. See why you don’t use the DOM.

  • Write a simple routine to take that state and output HTML which shows that state.

You’ll be rewarded with a much simpler and more reliable design.

 

Related pages