Using hook instead of polling