Setting up css maxHeight for sliding effect in react
Setting up maxHeight for sliding effect in react import React, { useState , useRef , useEffect } from "react" ; //... const accordionItemContentRef = useRef ( null ); useEffect (() => { if ( accordionItemContentRef . current && slideEffect) { accordionItemContentRef . current . style . maxHeight = activeIndex === null ? 0 : accordionItemContentRef . current . scrollHeight + "px" ; } }, [activeIndex]); //... <div ref = { accordionItemContentRef } // Ref to the content div