Clean up useDelayedState
This commit is contained in:
@@ -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];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user