mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-15 00:04:59 +08:00
Clean up useDelayedState
This commit is contained in:
parent
2eae6243bb
commit
74ccf7d820
@ -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…
Reference in New Issue
Block a user