I would like to discuss something that I was thinking for a while,
today we have many UI components that needs to detect clicks on them and outside of their container
to decide whether to be expanded, to disappear or to be modified in some other way.
what I was thinking is to set one click event listener on the
and each time a click would happen somewhere in the application,
it will update the Redux state with a simple object
of the attributes of the clicked element,
page and position where it had happen
and a timestamp.
In this way, other components that wants to get modified by mouse clicks can easily listen to the state changes, avoid extra event listeners and increase performance.
I am not sure if it is possible,
but a long term goal could be actually to create an UX INSIGHTS mechanism
by tracking the users clicks - if they agree - and keeping track of most visited pages in our app,
gather info about the most common scenarios or complication they have…
but that’s for another post right?
anyway I will glad to hear what are your thoughts and wisdom on this, thanks