Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/wojtekmaj/predict-input-value. Predicts the input value during KeyDown or KeyPress events, before the input is actually changed
Something went wrong. Try again.
TypeScript 97%
JavaScript 2%
<1%
Commits 281
Bump postcss from 8.5.22 to 8.5.26
Signed-off-by: dependabot[bot] <support@github.com>
README.md
Predict-Input-Value #
Predicts the input value during KeyDown or KeyPress events, before the input is actually changed.
tl;dr #
- Install by executing
npm install @wojtekmaj/predict-input-valueoryarn add @wojtekmaj/predict-input-value. - Import by adding
import predictInputValue from '@wojtekmaj/predict-input-value'. - Use it by writing
const nextValue = predictInputValue(event).
Example #
Conditions:
- Input: value
"hello" - Selected text:
"ello" - Key pressed:
i
function onKeyPress(event: React.KeyboardEvent<HTMLInputElement>): void {
const nextValue = predictInputValue(event); // "hi"
}
License #
The MIT License.
Author #
|
|
Wojciech Maj |