diff --git a/src/components/Checkbox/CheckboxBooleanInput.tsx b/src/components/Checkbox/CheckboxBooleanInput.tsx
index 28093f40..135044bf 100644
--- a/src/components/Checkbox/CheckboxBooleanInput.tsx
+++ b/src/components/Checkbox/CheckboxBooleanInput.tsx
@@ -1,7 +1,7 @@
import classnames from 'classnames';
-import React, { useState } from 'react';
+import React from 'react';
import type { InputProps } from 'reactstrap';
-import { getUniqueId } from '../../util/uniqueId';
+import { useUniqueId } from '../../util/uniqueId';
import FormGroup from '../Form/FormGroup';
import Input from '../Input/Input';
import Label from '../Label/Label';
@@ -19,7 +19,7 @@ function CheckboxBooleanInput({
value,
...inputProps
}: CheckboxBooleanInputProps) {
- const [generatedId] = useState(() => getUniqueId('checkbox-boolean-input-'));
+ const generatedId = useUniqueId('checkbox-boolean-input-');
const id = inputProps.id || generatedId;
const classNames = classnames('pt-2', className);
return (
diff --git a/src/components/Form/FormChoice.js b/src/components/Form/FormChoice.js
index 974126a0..212f12ea 100644
--- a/src/components/Form/FormChoice.js
+++ b/src/components/Form/FormChoice.js
@@ -1,63 +1,56 @@
import classname from 'classnames';
import React from 'react';
-import { getUniqueId } from '../../util/uniqueId';
+import { useUniqueId } from '../../util/uniqueId';
import Input from '../Input/Input';
import Label from '../Label/Label';
import FormGroup from './FormGroup';
-class FormChoice extends React.Component {
- constructor(props) {
- super(props);
- this.id = props.id || getUniqueId('form-choice-');
- }
-
- render() {
- /* eslint-disable-next-line @typescript-eslint/no-unused-vars -- Let's figure out a better way to omit props for this scenario */
- const { id, inline, disabled, children, containerClassName, type, value, ...attributes } =
- this.props;
-
- if (type === 'select') {
- return (
-
- );
- }
-
- const containerClasses = classname({ 'form-check-inline': inline }, containerClassName);
-
- const computedValue = value || children;
-
- const item = (
-
-
-
-
- );
+function FormChoice({ id, inline, disabled, children, containerClassName, type, value, ...props }) {
+ const generatedId = useUniqueId('form-choice-');
+ const idToUse = id || generatedId;
- if (inline) {
- return item;
- }
+ if (type === 'select') {
return (
-
- {item}
-
+
);
}
+
+ const containerClasses = classname({ 'form-check-inline': inline }, containerClassName);
+
+ const computedValue = value || children;
+
+ const item = (
+
+
+
+
+ );
+
+ if (inline) {
+ return item;
+ }
+
+ return (
+
+ {item}
+
+ );
}
export default FormChoice;
diff --git a/src/components/HasManyFields/HasManyFieldsRow.tsx b/src/components/HasManyFields/HasManyFieldsRow.tsx
index b6456604..d164d73e 100644
--- a/src/components/HasManyFields/HasManyFieldsRow.tsx
+++ b/src/components/HasManyFields/HasManyFieldsRow.tsx
@@ -1,7 +1,7 @@
import { Placement } from '@popperjs/core';
import classnames from 'classnames';
-import React, { useState } from 'react';
-import { getUniqueId } from '../../util/uniqueId';
+import React from 'react';
+import { useUniqueId } from '../../util/uniqueId';
import Button from '../Button/Button';
import ConfirmationButton, { ConfirmationButtonProps } from '../Button/ConfirmationButton';
import Icon from '../Icon/Icon';
@@ -33,7 +33,7 @@ const HasManyFieldsRow = ({
deleteProps,
...props
}: HasManyFieldsRowProps) => {
- const [id] = useState(() => getUniqueId('hmf-', 1));
+ const id = useUniqueId('hmf-', 1);
const classNames = classnames('mb-4 gx-0', className);
// The `disabled ?