Signals JS
Over the past few years, we’ve faced a variety of issues related to application state management and tools that help solve these problems. Recently, Signals as a mechanism for managing application state has been gaining popularity and rethinking. Today, most UI frameworks such as SolidJS, Vue, Preact, Qwik, and Angular already support Signals. Signals try to solve problems related to optimization of component rendering and integration with various UI frameworks, but can be also used outside of front-end development.
Signals are a wrapper that can notify certain parts of the code when they (the signals) change. They can contain both primitive values and complex data structures. Signals form a dependency graph where computed signals depend on state signals or other computed signals and ensure that changes are effectively propagated throughout the system. They also allow you to make a point rendering of a component only where the signal value is used and reduce the rendering of dependent components, which increases application performance. Signals automatically track their dependencies so that when the state of a signal changes, only the computed signals that depend on it update their values. Additionally, computed signals use memorization to cache their values and reduce the need for recalculations.
Many frameworks offered their own application state management mechanism, despite the lack of such a mechanism built into JS, so a proposal was made to add Signals to the JavaScript standard. The purpose of this proposal is to separate the reactive signals model from the rendering process, which will allow developers to change UI technologies without changing the code that is not related to the UI part. So, let’s continue to follow the development of Signals and new ways to use them.