@@ -305,7 +305,7 @@ const cardWithHorizontalImportsCode = `import {ClayCardWithInfo} from '@clayui/c
`;
const cardWithHorizontalCode = `const Component = () => {
- const [value, setValue] = React.useState(false);
+ const [value, setValue] = useState(false);
return (
diff --git a/clayui.com/src/components/clay/Chart.js b/clayui.com/src/components/clay/Chart.js
index eb08dcecec..ca6dc8f0d6 100644
--- a/clayui.com/src/components/clay/Chart.js
+++ b/clayui.com/src/components/clay/Chart.js
@@ -17,7 +17,7 @@ const ClayChart =
const chartImportsCode = `import ClayChart from '@clayui/charts';`;
const chartCode = `const Component = () => {
- const [active, setActive] = React.React.useState(false);
+ const [active, setActive] = useState(false);
const COLUMNS = [['data1', 100, 20, 30], ['data2', 20, 70, 100]];
const COLUMNS_2 = [['data1', 10, 50, 60], ['data2', 70, 30, 10]];
diff --git a/clayui.com/src/components/clay/Checkbox.js b/clayui.com/src/components/clay/Checkbox.js
index 7e35c28d10..79e03234d6 100644
--- a/clayui.com/src/components/clay/Checkbox.js
+++ b/clayui.com/src/components/clay/Checkbox.js
@@ -35,7 +35,7 @@ const checkboxContainerPropsImportsCode = `import {ClayCheckbox} from '@clayui/f
export const CheckboxContainerProps = () => {
const scope = {ClayCheckbox};
const code = `const Component = () => {
- const [value, setValue] = React.useState(false);
+ const [value, setValue] = useState(false);
const data = {
id: 'test'
@@ -68,7 +68,7 @@ const checkboxIndeterminateImportsCode = `import {ClayCheckbox} from '@clayui/fo
export const CheckboxIndeterminate = () => {
const scope = {ClayCheckbox};
const code = `const Component = () => {
- const [value, setValue] = React.useState(false);
+ const [value, setValue] = useState(false);
return (
{
const scope = {ClayCheckbox};
const code = `const Component = () => {
- const [value, setValue] = React.useState(false);
+ const [value, setValue] = useState(false);
return (
<>
@@ -143,7 +143,7 @@ const checkboxLabelImportsCode = `import {ClayCheckbox} from '@clayui/form';
export const CheckboxLabel = () => {
const scope = {ClayCheckbox};
const code = `const Component = () => {
- const [value, setValue] = React.useState(false);
+ const [value, setValue] = useState(false);
return (
{
const scope = {ClayCheckbox};
const code = `const Component = () => {
- const [value, setValue] = React.useState(false);
+ const [value, setValue] = useState(false);
return (
{
- const [customColors, setCustoms] = React.useState(['008000', '00FFFF', '0000FF']);
- const [color, setColor] = React.useState(customColors[0]);
+ const [customColors, setCustoms] = useState(['008000', '00FFFF', '0000FF']);
+ const [color, setColor] = useState(customColors[0]);
return (
{
);
};
-const dataProviderWithCacheRootLevelImportsCode = `import ClayDataProvider from '@clayui/data-provider';
-import React, {useContext} from 'react';`;
+const dataProviderWithCacheRootLevelImportsCode = `import ClayDataProvider from '@clayui/data-provider';`;
const dataProviderWithCacheRootLevelCode = `const Component = () => {
const storageContext = useContext(Store);
@@ -156,7 +155,7 @@ const useResourceWithNetworkStatusImportsCode = `import {useResource} from '@cla
`;
const useResourceWithNetworkStatusCode = `const Component = () => {
- const [state, setState] = React.useState(() => ({
+ const [state, setState] = useState(() => ({
error: false,
loading: false,
networkStatus: 4,
@@ -192,7 +191,7 @@ const useResourceWithVariablesChangeImportsCode = `import {useResource} from '@c
`;
const useResourceWithVariablesChangeCode = `const Component = () => {
- const [value, setValue] = React.useState('Rick');
+ const [value, setValue] = useState('Rick');
const {resource} = useResource({
link: 'https://rickandmortyapi.com/api/character/',
fetchDelay: 300,
diff --git a/clayui.com/src/components/clay/DatePicker.js b/clayui.com/src/components/clay/DatePicker.js
index f756fcee0a..467c73536b 100644
--- a/clayui.com/src/components/clay/DatePicker.js
+++ b/clayui.com/src/components/clay/DatePicker.js
@@ -14,7 +14,7 @@ const datePickerWithStateImportsCode = `import ClayDatePicker from '@clayui/date
const DatePickerWithState = () => {
const scope = {ClayDatePicker};
const code = `const Component = () => {
- const [value, setValue] = React.useState(null);
+ const [value, setValue] = useState(null);
return (
{
const scope = {ClayDatePicker};
const code = `const Component = () => {
- const [value, setValue] = React.useState(null);
+ const [value, setValue] = useState(null);
return (
{
const scope = {ClayDatePicker};
const code = `const Component = () => {
- const [value, setValue] = React.useState(null);
+ const [value, setValue] = useState(null);
return (
{
const scope = {ClayDatePicker};
const code = `const Component = () => {
- const [value, setValue] = React.useState(null);
+ const [value, setValue] = useState(null);
return (
{
- const [active, setActive] = React.useState(false);
+ const [active, setActive] = useState(false);
return (
{
- const [value, setValue] = React.useState();
+ const [value, setValue] = useState();
const items = [
{
label: 'clickable',
diff --git a/clayui.com/src/components/clay/DualListBox.js b/clayui.com/src/components/clay/DualListBox.js
index d8f0bdd727..3ed3bc7950 100644
--- a/clayui.com/src/components/clay/DualListBox.js
+++ b/clayui.com/src/components/clay/DualListBox.js
@@ -48,9 +48,9 @@ const dualListBoxCode = `const Component = () => {
],
];
- const [items, setItems] = React.useState(moveBoxesOptions);
- const [leftSelected, setLeftSelected] = React.useState([]);
- const [rightSelected, setRightSelected] = React.useState([]);
+ const [items, setItems] = useState(moveBoxesOptions);
+ const [leftSelected, setLeftSelected] = useState([]);
+ const [rightSelected, setRightSelected] = useState([]);
return (
{
- const [active, setActive] = React.useState(false);
+ const [active, setActive] = useState(false);
return (
@@ -40,7 +40,7 @@ const Form = () => {
};
const formValidationCode = `const Component = () => {
- const [active, setActive] = React.useState(false);
+ const [active, setActive] = useState(false);
return (
@@ -105,7 +105,7 @@ const FormValidation = () => {
};
const formTextCode = `const Component = () => {
- const [active, setActive] = React.useState(false);
+ const [active, setActive] = useState(false);
return (
diff --git a/clayui.com/src/components/clay/Label.js b/clayui.com/src/components/clay/Label.js
index b1faa3b887..196f163778 100644
--- a/clayui.com/src/components/clay/Label.js
+++ b/clayui.com/src/components/clay/Label.js
@@ -12,7 +12,7 @@ const labelImportsCode = `import ClayLabel from '@clayui/label';
`;
const LabelCode = `const Component = () => {
- const [visible, setVisible] = React.useState(true);
+ const [visible, setVisible] = useState(true);
return visible ? (
{
},
];
- const [searchMobile, setSearchMobile] = React.useState(false);
+ const [searchMobile, setSearchMobile] = useState(false);
const viewTypeActive = viewTypes.find(type => type.active);
diff --git a/clayui.com/src/components/clay/Modal.js b/clayui.com/src/components/clay/Modal.js
index ae7f8896a9..d342c115c9 100644
--- a/clayui.com/src/components/clay/Modal.js
+++ b/clayui.com/src/components/clay/Modal.js
@@ -15,7 +15,7 @@ import ClayModal, {useModal} from '@clayui/modal';
`;
const modalCode = `const Component = () => {
- const [visible, setVisible] = React.useState(false);
+ const [visible, setVisible] = useState(false);
const {observer, onClose} = useModal({
onClose: () => setVisible(false),
});
diff --git a/clayui.com/src/components/clay/MultiSelect.js b/clayui.com/src/components/clay/MultiSelect.js
index a99726b519..f153020515 100644
--- a/clayui.com/src/components/clay/MultiSelect.js
+++ b/clayui.com/src/components/clay/MultiSelect.js
@@ -17,8 +17,8 @@ const multiSelectImportsCode = `import ClayMultiSelect from '@clayui/multi-selec
`;
const multiSelectCode = `const Component = () => {
- const [value, setValue] = React.useState('');
- const [items, setItems] = React.useState([
+ const [value, setValue] = useState('');
+ const [items, setItems] = useState([
{
label: 'one',
value: '1',
@@ -57,8 +57,8 @@ const multiSelectWithAutocompleteImportsCode = `import ClayMultiSelect from '@cl
`;
const multiSelectWithAutocompleteCode = `const Component = (props) => {
- const [value, setValue] = React.useState('');
- const [items, setItems] = React.useState([
+ const [value, setValue] = useState('');
+ const [items, setItems] = useState([
{
label: 'one',
value: '1',
@@ -120,8 +120,8 @@ import ClayMultiSelect from '@clayui/multi-select';
`;
const multiSelectWithSelectButtonCode = `const Component = () => {
- const [value, setValue] = React.useState('');
- const [items, setItems] = React.useState([
+ const [value, setValue] = useState('');
+ const [items, setItems] = useState([
{
label: 'one',
value: '1',
@@ -194,8 +194,8 @@ const MultiSelectInputWithSelectButton = () => {
};
const multiSelectWithValidationCode = `const Component = () => {
- const [value, setValue] = React.useState('');
- const [items, setItems] = React.useState([
+ const [value, setValue] = useState('');
+ const [items, setItems] = useState([
{
label: 'one',
value: '1',
@@ -314,8 +314,8 @@ const multiSelectWithCustomAutocompleteCode = `const MenuCustom = ({
);
const Component = () => {
- const [value, setValue] = React.useState('');
- const [items, setItems] = React.useState([
+ const [value, setValue] = useState('');
+ const [items, setItems] = useState([
{
email: 'one@example.com',
label: 'One',
diff --git a/clayui.com/src/components/clay/MultiStepNav.js b/clayui.com/src/components/clay/MultiStepNav.js
index ca392205d3..46def6a839 100644
--- a/clayui.com/src/components/clay/MultiStepNav.js
+++ b/clayui.com/src/components/clay/MultiStepNav.js
@@ -14,7 +14,7 @@ const multiStepNavImportsCode = `import ClayMultiStepNav from '@clayui/multi-ste
`;
const multiStepNavCode = `const Component = () => {
- const [value, setValue] = React.useState(1);
+ const [value, setValue] = useState(1);
const steps = [
{
@@ -98,7 +98,7 @@ const multiStepNavWithBasicItemsImportsCode = `import {ClayMultiStepNavWithBasic
`;
const multiStepNavWithBasicItemsCode = `const Component = (props) => {
- const [active, setActive] = React.useState(0);
+ const [active, setActive] = useState(0);
const steps = [
{
diff --git a/clayui.com/src/components/clay/Pagination.js b/clayui.com/src/components/clay/Pagination.js
index 271bc44069..04776db49f 100644
--- a/clayui.com/src/components/clay/Pagination.js
+++ b/clayui.com/src/components/clay/Pagination.js
@@ -33,7 +33,7 @@ const paginationWithBasicItemsImportsCode = `import {ClayPaginationWithBasicItem
`;
const PaginationWithBasicItemsCode = `const Component = () => {
- const [active, setActive] = React.useState(8);
+ const [active, setActive] = useState(8);
return (
{
- const [activePage, setActivePage] = React.useState(1);
- const [delta, setDelta] = React.useState(5);
+ const [activePage, setActivePage] = useState(1);
+ const [delta, setDelta] = useState(5);
const deltas = [
{
diff --git a/clayui.com/src/components/clay/RadioGroup.js b/clayui.com/src/components/clay/RadioGroup.js
index 2512941474..e739b12eba 100644
--- a/clayui.com/src/components/clay/RadioGroup.js
+++ b/clayui.com/src/components/clay/RadioGroup.js
@@ -12,7 +12,7 @@ const radioGroupImportsCode = `import {ClayRadio, ClayRadioGroup} from '@clayui/
`;
const radioGroupCode = `const Component = () => {
- const [value, setValue] = React.useState('one');
+ const [value, setValue] = useState('one');
return (
{
},
];
- const [items, setItems] = React.useState(selectBoxItems);
- const [value, setValue] = React.useState([]);
+ const [items, setItems] = useState(selectBoxItems);
+ const [value, setValue] = useState([]);
return (
{
- const [value, setValue] = React.useState(10);
+ const [value, setValue] = useState(10);
return (
diff --git a/clayui.com/src/components/clay/Table.js b/clayui.com/src/components/clay/Table.js
index 165a347b97..d216bfdc53 100644
--- a/clayui.com/src/components/clay/Table.js
+++ b/clayui.com/src/components/clay/Table.js
@@ -12,7 +12,7 @@ const tableImportsCode = `import ClayTable from '@clayui/table';
`;
const tableCode = `const Component = () => {
- const [value, setValue] = React.useState('one');
+ const [value, setValue] = useState('one');
return (
diff --git a/clayui.com/src/components/clay/Tabs.js b/clayui.com/src/components/clay/Tabs.js
index 35f4bc9e29..937633fd97 100644
--- a/clayui.com/src/components/clay/Tabs.js
+++ b/clayui.com/src/components/clay/Tabs.js
@@ -14,7 +14,7 @@ const tabsImportsCode = `import ClayTabs from '@clayui/tabs';
`;
const tabsCode = `const Component = () => {
- const [activeTabKeyValue, setActiveTabKeyValue] = React.useState(0);
+ const [activeTabKeyValue, setActiveTabKeyValue] = useState(0);
return (
<>
@@ -81,7 +81,7 @@ const tabsDropdownCode = `const Component = () => {
trigger,
...others
}) => {
- const [active, setActive] = React.React.useState(false);
+ const [active, setActive] = useState(false);
return (
{
);
};
- const [activeTabKeyValue, setActiveTabKeyValue] = React.React.useState(0);
+ const [activeTabKeyValue, setActiveTabKeyValue] = useState(0);
const dropdownTabsItems = [
{
diff --git a/clayui.com/src/components/clay/TimePicker.js b/clayui.com/src/components/clay/TimePicker.js
index 5cc8daea4a..52117988d8 100644
--- a/clayui.com/src/components/clay/TimePicker.js
+++ b/clayui.com/src/components/clay/TimePicker.js
@@ -12,7 +12,7 @@ const timePickerImportsCode = `import ClayTimePicker from '@clayui/time-picker';
`;
const timePickerCode = `const Component = () => {
- const [state, setState] = React.useState({
+ const [state, setState] = useState({
hours: '--',
minutes: '--',
});
diff --git a/clayui.com/src/components/clay/Toggle.js b/clayui.com/src/components/clay/Toggle.js
index 9041544111..5a6f027d40 100644
--- a/clayui.com/src/components/clay/Toggle.js
+++ b/clayui.com/src/components/clay/Toggle.js
@@ -9,7 +9,7 @@ import React from 'react';
import Editor from '../Editor';
const ToggleWithRadioGroup = `const Component = () => {
- const [value, setValue] = React.useState('foo');
+ const [value, setValue] = useState('foo');
return (
{
};
const ToggleCode = `const Component = () => {
- const [toggled, setToggle] = React.useState(false);
+ const [toggled, setToggle] = useState(false);
return (