Rewarding good behavior immediately after it happens helps your dog make the connection between the action
https://www.nck9.us/programs/puppy-training/
Rewarding good behavior immediately after it happens helps your dog make the connection between the action and the reward, enhancing learning speed