From 05da37fc185a0856b01bf60bfdb9e2b6915e544e Mon Sep 17 00:00:00 2001 From: streamich Date: Mon, 29 Oct 2018 21:40:36 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20start=20work=20on=20use?= =?UTF-8?q?DropArea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/useDropArea.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/useDropArea.ts diff --git a/README.md b/README.md index 637eab3c..1b63a1ad 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@

- [**UI**](./docs/UI.md) - - [`useAudio`](./docs/useAudio.md) — plays audio and exposes its controls. [![][img-demo]](https://codesandbox.io/s/5v7q47knwl) + - [`useAudio`](./docs/useAudio.md) — plays audio and exposes its controls. [![][img-demo]](https://codesandbox.io/s/2o4lo6rqy) - [`useSpeech`](./docs/useSpeech.md) — synthesizes speech from a text string. [![][img-demo]](https://codesandbox.io/s/n090mqz69m) - [`useVideo`](./docs/useVideo.md) — plays video, tracks its state, and exposes playback controls.
diff --git a/src/useDropArea.ts b/src/useDropArea.ts new file mode 100644 index 00000000..9710b709 --- /dev/null +++ b/src/useDropArea.ts @@ -0,0 +1,14 @@ +import * as React from 'react'; + +const useDropArea = (el: React.ReactElement) => { + if (process.env.NODE_ENV !== 'production') { + if (!React.isValidElement(el)) { + throw new TypeError( + 'useDropArea first argument must be a valid ' + + 'React element, such as
.' + ); + } + } +}; + +export default useDropArea;