redux-cursor icon indicating copy to clipboard operation
redux-cursor copied to clipboard

How can I listen for changes in my local cursor ?

Open Offirmo opened this issue 8 years ago • 3 comments

Redux stores have the .subscribe( to listen for changes.

I can't find how to access such a basic function on my local sub-store

Offirmo avatar Feb 01 '17 04:02 Offirmo

Thanks for noticing this. Indeed, there is no such functionality in redux-cursor. Because we don’t have a concept of sub-store, there is nothing to .subscribe on. We only have local state, and changes in that will automatically re-render a particular component using basic React mechanisms.

I could see a feature you request being added, provided there is a good rationale and design behind it. But it would require you to code it yourself, as there are no plans for this feature in the project. =)

Until then, I think it’s safe to close this issue as "unfortunately impossible".

denis-sokolov avatar Feb 01 '17 10:02 denis-sokolov

What if we don't use React ?

Anyway, I'm already coding it right now. (Yves here. Hello Denis)

Offirmo avatar Feb 01 '17 10:02 Offirmo

If you re-render from the top, you would not need to do subscribing on the local state. But for performance reasons, sure. In which case this performance improvement is also useful for the React scenario. So by all means, do add the feature, sounds like a good idea.

(Hello, Yves! Didn’t know it’s you.)

denis-sokolov avatar Feb 01 '17 11:02 denis-sokolov