feat(docs): Add power profiler
This commit is contained in:
parent
0df7110058
commit
4ef11ac4aa
8 changed files with 1045 additions and 0 deletions
23
docs/src/utils/hooks.js
Normal file
23
docs/src/utils/hooks.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2021 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
export const useInput = (initialValue) => {
|
||||
const [value, setValue] = useState(initialValue);
|
||||
|
||||
return {
|
||||
value,
|
||||
setValue,
|
||||
bind: {
|
||||
value,
|
||||
onChange: (event) => {
|
||||
const target = event.target;
|
||||
setValue(target.type === "checkbox" ? target.checked : target.value);
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue