From 178bb8449f5edc12dd491c60b5984d5cbfd85961 Mon Sep 17 00:00:00 2001 From: IDAbyLIGL Date: Wed, 21 Oct 2020 15:37:02 +0200 Subject: [PATCH] Made AccordionItem toggleable through "isExpanded" --- libraries/core-react/src/Accordion/AccordionItem.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/core-react/src/Accordion/AccordionItem.tsx b/libraries/core-react/src/Accordion/AccordionItem.tsx index 2126b25f9f..2a75a93fdd 100644 --- a/libraries/core-react/src/Accordion/AccordionItem.tsx +++ b/libraries/core-react/src/Accordion/AccordionItem.tsx @@ -1,4 +1,4 @@ -import React, { forwardRef, useState, ReactElement } from 'react' +import React, { forwardRef, useState, useEffect, ReactElement } from 'react' import type { AccordionProps } from './Accordion.types' type Props = { @@ -52,6 +52,10 @@ const AccordionItem = forwardRef(function AccordionItem( }) }) + useEffect(() => { + setExpanded(isExpanded) + }, [isExpanded]) + return (
{Children}