dotlottie / player-component

https://dotlottie.io
MIT License
206 stars 28 forks source link

Got Uncaught TypeError: (0 , import_react3.useSyncExternalStore) is not a function #167

Closed karthest closed 1 year ago

karthest commented 1 year ago

Node : v14.17.2 React : v17.0.2 Code :

import React from 'react'
import './index.scss'
import DotLottie from './assets/lottie/full/data.lottie?url'
import { DotLottiePlayer, Controls } from '@dotlottie/react-player';
import '@dotlottie/react-player/dist/index.css';

const App = (): JSX.Element => {

  return (
    <>
      <DotLottiePlayer
        src={DotLottie}
        autoplay
        loop
      >
        <Controls></Controls>
      </DotLottiePlayer>
    </>
  )
}

export default App 

Got this error:

image

and the lottie animation didn't show as expect.

afsalz commented 1 year ago

@karthest, Thank you for your interest in our react-player.

Currently, our react-player is designed to support React version 18 and above. As a result, features like useSyncExternalStore are implemented specifically for React 18.

We recommend using our player-component for older versions of React.

karthest commented 1 year ago

Thanks for your explaination. player-component works great.

karthest commented 1 year ago

Another question : Is there a way to pack lottie json file and required images into a dotlottie file ? Or how to deal with assets ?

afsalz commented 1 year ago

@karthest Yes, packing assets within .lottie is possible. Our dotlottie-js library may help with your use case. Also, please refer to dotlottie structure to learn more about the dotlottie structure.

karthest commented 1 year ago

Thanks a lot