You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I love HOCs, and I believe it would be amazing if picking up this library was as simple as doing this:
constApp=props=><MyFullApp/>// Magic, without changing anything but this line in my entire massive code base,// space bar suddenly triggers something :)exportdefaultwithHotKeys({handlers: {space: ()=>console.log('it works!')},global: true})(App);
Or even pass it as the second argument, in the componentProps of the HOC, but that does not seem to work (Am I doing something wrong?).
To be honest, I think that the API of the HOC is bad, since both arguments are passed down to <HotKeys />, in my opinion, it should simply be withHotKeys( componentProps: Object ) to which you can pass all the props you want, includinghandlers. Sadly, this would be a breaking change, but I believe simpler, and better design.
Also, global would be a shortcut for focused: true, attach: window, which I had to dig for in the issues to find out.
The text was updated successfully, but these errors were encountered:
I love HOCs, and I believe it would be amazing if picking up this library was as simple as doing this:
Or even pass it as the second argument, in the
componentProps
of the HOC, but that does not seem to work (Am I doing something wrong?).To be honest, I think that the API of the HOC is bad, since both arguments are passed down to
<HotKeys />
, in my opinion, it should simply bewithHotKeys( componentProps: Object )
to which you can pass all the props you want, includinghandlers
. Sadly, this would be a breaking change, but I believe simpler, and better design.Also,
global
would be a shortcut forfocused: true, attach: window
, which I had to dig for in the issues to find out.The text was updated successfully, but these errors were encountered: