Skip to main content

Migration to 5.x version

From version 4 to version 5, there have been some changes. The key in TBearSlideItemDataList was deleted, ReactNode was used directly, and the sliding selection judgment under automatic width images was optimized.

BearSlideItem

No additional use of object key is check, directly use react's own optimization judgment

v4.x

import {BearSlideItem} from 'bear-react-carousel';

const data = infos.map(row => {
return {
key: row.id,
children: <BearSlideItem as="card"> {/* or image **/}
{row.name}
</BearSlideItem>
}
});

v5.x Change to

import {BearSlideCard, BearSlideImage} from 'bear-react-carousel';

const data = infos.map(row => {
return <BearSlideCard key={row.id}> {/* or BearSlideImage **/}
{row.name}
</BearSlideCard>
});

Remove props isSlideItemMemo

Use react optimization mode directly, and useMemo yourself if necessary