const preact = require('preact'); const { connect } = require('preact-redux'); const addState = connect( (state) => { const { ws, cryps } = state; function sendGameJoin(gameId) { return ws.sendGameJoin(gameId, [cryps[0].id]); } return { account: state.account, sendGameJoin }; }, ); function GameJoinButton({ account, sendGameJoin }) { let gameId = ''; if (!account) return
...
; return (
(gameId = e.target.value)} />
); } module.exports = addState(GameJoinButton);