Skip to content

usePostMessage ​

browser
test coverage
Last changed: last month

Hook that allows you to receive messages from other origins

typescript
import { usePostMessage } from '@siberiacancode/reactuse';

Usage ​

typescript
const postMessage = usePostMessage();

Demo ​

Api ​

Parameters

NameTypeDefaultNote
originstring | string[]-The origin of the message
callback(message: Message) => Message-callback to get received message

Source ​

Source • Demo

Contributors ​

Avatardebabin
Avatarbelk1ng

Released under the MIT License.