Change Hook Running On Init
See original GitHub issueHi guys, I have a weird issue the change hook is running on plugin initializing, here is the test i did:
// Initialization
let picker = new CP(element);
// change hook listener
picker.on('change', function(r, g, b, a) {
// firing immediately
console.log(1);
});
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Skip hook change (useEffect) on initialize - Stack Overflow
I am using hooks for the selected index. I realized that hooks works async. When a new value was selected the old value...
Read more >Simplifying state initializers with React Hooks - LogRocket Blog
1. Configurable initial state ... On line 2, the initial state within the Hook is set. ... Instead of hardcoding the initial state,...
Read more >Lifecycle hooks - Angular
Called immediately after ngOnChanges() on every change detection run, and immediately after ngOnInit() on the first run. ngAfterContentInit(), Respond after ...
Read more >Rules of Hooks - React
Hooks are JavaScript functions, but you need to follow two rules when using ... Initialize the name state variable with 'Mary' useEffect(persistForm) //...
Read more >Angular Lifecycle Hooks: ngOnChanges, ngOnInit, and more
The hook receives one optional parameter of type SimpleChanges . This value contains information on the changed input-bound properties.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks, that’s exactly how i solved the issue.
@evolross There’s a
drag
event that you can use to prevent this behaviour if you want 😉