This kind of reads like programming philosophy but is a very good read about React hooks.
The Impedance Mismatch
This term is sometimes thrown around, and Phil Haack explains it like this:One might say Databases are from Mars and Objects are from Venus. Databases do not map naturally to object models. It’s a lot like trying to push the north poles of two magnets together.Our “impedance mismatch” is not between Databases and Objects. It is between the React programming model and the imperativesetIntervalAPI.
A React component may be mounted for a while and go through many different states, but its render result describes all of them at once.
By contrast,setIntervaldoes not describe a process in time — once you set the interval, you can’t change anything about it except clearing it.
That’s the mismatch between the React model and thesetIntervalAPI.