react web game : dynamic route

This commit is contained in:
haerong22
2021-03-26 21:31:39 +09:00
parent 907a11fe93
commit c9729c8e69

View File

@@ -1,10 +1,19 @@
import React, { Component } from "react";
import Lotto from "./games/Lotto";
import NumberBaseball from "./games/NumberBaseball";
import RSP from "./games/RSP";
// import { withRouter } from "react-router-dom";
class GameMatcher extends Component {
render() {
console.log(this.props);
return <div>GameMatcher</div>;
if (this.props.match.params.name === "number-baseball") {
return <NumberBaseball />;
} else if (this.props.match.params.name === "rock-scissors-paper") {
return <RSP />;
} else if (this.props.match.params.name === "lotto-generator") {
return <Lotto />;
}
return <>게임이 없습니다.</>;
}
}