From 3b1dfd9bbdab58e8aa78fba3efe97bb77541f861 Mon Sep 17 00:00:00 2001 From: Christophe Braud Date: Sun, 18 Apr 2021 10:51:56 +0200 Subject: [PATCH] Use react fragment to allow a Gamepad component without children --- src/Gamepad.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gamepad.js b/src/Gamepad.js index 89092cc..29d01bc 100644 --- a/src/Gamepad.js +++ b/src/Gamepad.js @@ -134,7 +134,7 @@ class Gamepad extends React.Component { updateButton(buttonName, pressed) { if (this.padState.buttons[buttonName] === undefined) { return - } + } if (this.padState.buttons[buttonName] !== pressed) { this.padState.buttons[buttonName] = pressed @@ -235,7 +235,7 @@ class Gamepad extends React.Component { } render() { - return React.Children.only(this.props.children) + return this.props.children ?? React.Fragment } }