Skip to content

Instantly share code, notes, and snippets.

@dzrw
dzrw / gist:5f03c169a4119a63abb785b1c1249656
Last active December 13, 2018 19:26
Hooks with Symbol keys
function StatusMessage() {
const HOOK_WINDOW_WIDTH = Symbol("window-width");
const HOOK_NETWORK_STATUS = Symbol("network-status");
const width = useWindowWidth(HOOK_WINDOW_WIDTH);
const isOnline = useNetworkStatus(HOOK_NETWORK_STATUS);
return (
<>
<p>Window width is {width}</p>
<p>You are {isOnline ? 'online' : 'offline'}</p>
/*
PolyK library
url: http://polyk.ivank.net
Released under MIT licence.
Copyright (c) 2012 Ivan Kuckir
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation