Вот как выглядит код
import { TPlaylist } from 'types';
const [playlist, setPlaylist] = useState<Array<TPlaylist>>([])
useEffect(() => {
if (playlistModel.Playlist) {
setPlaylist(playlistModel.Playlist.channels)
console.log(playlist)
}
}, [playlistModel.Playlist])
Сам types
import { TChannel } from 'types';
export type TPlaylist = {
channels: Array<TChannel>;
name_ru: string;
refPlaylist: any;
countChannelInColumn: number;
};
и TChannel
export type TChannel = {
our_id: number;
index: number;
image: string;
name_ru: string;
};