From 9e9bcb4974e667720332a7e648aa027d569e5d25 Mon Sep 17 00:00:00 2001 From: Jorik Schellekens Date: Mon, 1 Jun 2020 12:04:47 +0100 Subject: [PATCH] Move id generator into constrcutor --- src/components/views/elements/StyledCheckbox.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/views/elements/StyledCheckbox.tsx b/src/components/views/elements/StyledCheckbox.tsx index 025164a24f..b4e40e4b64 100644 --- a/src/components/views/elements/StyledCheckbox.tsx +++ b/src/components/views/elements/StyledCheckbox.tsx @@ -26,6 +26,7 @@ interface IState { } export default class StyledCheckbox extends React.PureComponent { + private id: string; public static readonly defaultProps = { className: "", @@ -33,16 +34,16 @@ export default class StyledCheckbox extends React.PureComponent constructor(props: IProps) { super(props); + this.id = "checkbox_" + randomString(10); } public render() { const { children, className, ...otherProps } = this.props; // 56^10 so unlikely chance of collision. - const id = "checkbox_" + randomString(10); return [ - -