export const Shaker: React.FC<ShakerProps> = (props) => {
const { items, loadMore, style, className, customLink } = props;
const [componentState, setComponentState] = React.useState<ShakerState>({
...
});
return (
<ShakerSlideItem
cards={componentState.cards}
isActionDisabled={componentState.isActionDisabled}
showMoreClickHandler={showMoreClickHandler}
description={getCurrentDescription(componentState.cards)}
style={style}
className={className}
customLink={customLink}
/>
);
};
const Component = ({ name }) => {
if(!name) return null;
React.useEffect(() => {
... тут вылетает ошибка как раз таки та что у тебя в косоле, если не ошибаюсь
}, [])
export const SpecialBlockSlider: React.FC<SpecialBlockSliderProps> = ({ block }) => {
const somePropsUndefined =
!block || !block?.item || !block?.item?.publisher || !block?.item?.publisher?.items || !block?.item?.publisher?.items?.length;
if (somePropsUndefined) {
return null;
}
const {
rubric, title,
} = block.item;
const itemsProps = getSlides({
publisherItems: block.item.publisher.items, rubric,
});
return (
<article className="gutter gutter-t-0 ov-h">
<SectionHeader title={title} type="l" />
<div className="gutter-b">
<Shaker items={itemsProps} loadMore={() => null} customLink={Link} />
</div>
</article>
);
};
const {
rubric, title,
} = block.item;
const itemsProps = getSlides({
publisherItems: block.item.publisher.items, rubric,
});
return null;
}
if (somePropsUndefined) {
return null;
}