Skip to content

Commit

Permalink
move function outside the component
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaelaCretu11 committed Jul 13, 2023
1 parent c2ecb89 commit aa5c542
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/manage/Blocks/Accordion/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import './editor.less';

const animationDuration = 500;

const useQuery = (location) => {
const { search } = location;
return React.useMemo(() => new URLSearchParams(search), [search]);
};

const View = (props) => {
const { data } = props;
const location = useLocation();
Expand All @@ -23,12 +28,7 @@ const View = (props) => {
const accordionConfig = config.blocks.blocksConfig.accordion;
const { titleIcons } = accordionConfig;

const useQuery = () => {
const { search } = location;
return React.useMemo(() => new URLSearchParams(search), [search]);
};

const query = useQuery();
const query = useQuery(location);
const activePanels = query.get('activeAccordion')?.split(',');
const [firstIdFromPanels] = panels[0];

Expand Down

0 comments on commit aa5c542

Please sign in to comment.