From cdc7f61fa1dcc72e10fafa4de18b5cada810cd86 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 11 Apr 2021 15:09:00 -0700 Subject: [PATCH] chore: Enable HMR for frontend code (#2024) * chore: Enable HMR for frontend code closes #2021 * revert --- app/components/Button.js | 52 ++++++++++++----------- app/components/Theme.js | 15 +++---- app/index.js | 7 ++-- package.json | 4 +- server/app.js | 1 - webpack.config.dev.js | 8 +++- yarn.lock | 91 +++++++++++++++++++++++++++++++++++++--- 7 files changed, 134 insertions(+), 44 deletions(-) diff --git a/app/components/Button.js b/app/components/Button.js index aa15e984..bfef711e 100644 --- a/app/components/Button.js +++ b/app/components/Button.js @@ -134,30 +134,32 @@ export type Props = {| "data-event-action"?: string, |}; -function Button({ - type = "text", - icon, - children, - value, - disclosure, - innerRef, - neutral, - ...rest -}: Props) { - const hasText = children !== undefined || value !== undefined; - const hasIcon = icon !== undefined; +const Button = React.forwardRef( + ( + { + type = "text", + icon, + children, + value, + disclosure, + neutral, + ...rest + }: Props, + innerRef + ) => { + const hasText = children !== undefined || value !== undefined; + const hasIcon = icon !== undefined; - return ( - - - {hasIcon && icon} - {hasText && } - {disclosure && } - - - ); -} + return ( + + + {hasIcon && icon} + {hasText && } + {disclosure && } + + + ); + } +); -export default React.forwardRef((props, ref) => ( -