From 7f54cad64248575366d6154ad7dff68905c17ec5 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Wed, 16 Oct 2019 15:07:33 +0300 Subject: [PATCH] fix: example in the docs; --- docs/useMediatedState.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/docs/useMediatedState.md b/docs/useMediatedState.md index 34a5cdb590..0779a2e97d 100644 --- a/docs/useMediatedState.md +++ b/docs/useMediatedState.md @@ -7,21 +7,18 @@ A lot like the standard `useState`, but with mediation process. import * as React from 'react'; import { useMediatedState } from '../useMediatedState'; -const InputMediator = s => s.replace(/[\s]+/, ' '); +const inputMediator = s => s.replace(/[\s]+/g, ' '); const Demo = () => { - const [state, setState] = useMediatedState('', InputMediator); + const [state, setState] = useMediatedState(inputMediator, ''); return (
You will not be able to enter more than one space
- ) => { - setState(ev.target.value); - }} + ) => { + setState(ev.target.value); + }} />
);