Clean up useDelayedState
This commit is contained in:
parent
2eae6243bb
commit
74ccf7d820
1 changed files with 2 additions and 3 deletions
|
@ -14,8 +14,9 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { useState, useRef, useEffect } from "react";
|
||||
import { useState, useRef } from "react";
|
||||
|
||||
// Like useState, except state updates can be enqueued with a configurable delay
|
||||
export const useDelayedState = <T>(
|
||||
initial?: T
|
||||
): [T, (value: T, delay: number) => void, (value: T) => void] => {
|
||||
|
@ -38,7 +39,5 @@ export const useDelayedState = <T>(
|
|||
setState(value);
|
||||
};
|
||||
|
||||
useEffect(() => console.log("got", state), [state]);
|
||||
|
||||
return [state, setStateDelayed, setStateImmediate];
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue