My bad, I got the wording wrong. What I meant to say is... well take an example:
const todos = [
{ title: "Water the plants", done: false },
{ title: "Buy milk", done: true }
];
const todosToDo = () => todos.filter((todo) => !todo.done);
Here every time we call todosToDo
for something like logging, it recalculates all the todos that are not done. This impacts the performance. Instead, we can bind todosToDo
to todos
so that it is only updated when todos
is changed.
const todosToDo <= todos.filter((todo) => !todo.done);
It doesn't have to be <=
. It could be anything even a keyword.
We could take this to function level...
<= console.log(`Todos changed ${todosToDo}`);
Above, console.log
is called whenever todosToDo
is changed. This could be powerful for debugging.
Hope I have explained it enough. Thank you .