Toggle navigation
Toggle navigation
This project
Loading...
Sign in
강동현
/
nodejs-game
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Overnap
2021-06-01 20:19:58 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d8a29f422f47a0e38740d7c27cd3d15a6e2b538b
d8a29f42
1 parent
5b1cfd3b
RouteComponentProps 대신 Context를 사용하도록 변경
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
web/src/pages/Login.tsx
web/src/pages/Rooms.tsx
web/src/pages/Login.tsx
View file @
d8a29f4
import React, { useContext, useState } from 'react';
import {
RouteComponentProps
} from 'react-router';
import {
useHistory
} from 'react-router';
import { Main } from '../components/common/Main';
import { MessageResponse, MessageType } from '../components/common/types';
import SocketContext from '../contexts/SocketContext';
export const Login: React.FC<RouteComponentProps> = ({ history }) => {
export const Login: React.FC = () => {
const history = useHistory();
const socket = useContext(SocketContext);
const [ username, setUsername ] = useState("");
...
...
web/src/pages/Rooms.tsx
View file @
d8a29f4
import React, { useContext, useEffect, useState } from 'react';
import { RouteComponentProps } from 'react-router';
import { Main } from '../components/common/Main';
import { MessageResponse, MessageType } from '../components/common/types';
import { RoomInfo } from '../components/rooms/RoomInfo';
import { Room } from '../components/rooms/types';
import SocketContext from '../contexts/SocketContext';
export const Rooms: React.FC
<RouteComponentProps> = ({ history }
) => {
export const Rooms: React.FC
= (
) => {
const socket = useContext(SocketContext);
const [ rooms, setRooms ] = useState<Room[]>([]);
...
...
Please
register
or
login
to post a comment