Skip to content

Commit

Permalink
chore: state 이름, setState함수이름 변경
Browse files Browse the repository at this point in the history
stream, setStream에서 streamList, setStreamList로 변경
  • Loading branch information
d0422 committed Nov 10, 2023
1 parent d30ae82 commit 30298f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontEnd/src/pages/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function StreamVideo({ stream }: { stream: MediaStream }) {

export default function Room() {
const videoRef = useRef<HTMLVideoElement>(null);
const [stream, setStream] = useState<StreamObject[]>([]);
const [streamList, setStreamList] = useState<StreamObject[]>([]);
const { roomId } = useParams();

useEffect(() => {
Expand All @@ -27,7 +27,7 @@ export default function Room() {
.then((video) => {
(videoRef.current as HTMLVideoElement).srcObject = video;
streamModel.subscribe(() => {
setStream(() => streamModel.getStream());
setStreamList(() => streamModel.getStream());
});
const socket = createSocket(video);
socket.connect();
Expand All @@ -40,8 +40,8 @@ export default function Room() {
return (
<div>
<video ref={videoRef} muted autoPlay />
{stream.map((item) => {
return <StreamVideo key={item.id} stream={item.stream} />;
{streamList.map(({ id, stream }) => {
return <StreamVideo key={id} stream={stream} />;
})}
</div>
);
Expand Down

0 comments on commit 30298f1

Please sign in to comment.