So I'm trying to use the custom collapse from this stackoverflow post and when I include it Cannot read properties of undefined (reading 'header') problem happened. I have no idea what is going on and it works completely fine on Codepen.
Here's the code:
It's basically the same , i just added some icon.
const CustomCollapse = ({props}) => {
const [disabled, setDisabled] = useState(true);
return (
<StyledCollapse onChange={() => setDisabled(prev => !prev)}>
<AntCollapse.Panel
header={props.header}
key="1"
showArrow={false}
bordered={false}
extra={
<span>
<span style={{ color: "#0076de", float: "right" }}>
{disabled ? <div id="themeBox"><p>+10</p></div> : <img src={arrowDownIcon} alt="" style={{objectFit:'contain'}} />}
</span>
</span>
}
>
{props.children}
</AntCollapse.Panel>
</StyledCollapse>
);
};
Here is where I use the Collapse:
<div className={styles.telegramLinks}>
<AntCollapse header="test">
<h1>test</h1>
</AntCollapse>
</div>