By using React.memo() and PureComponent, React can avoid doing any
re-rendering of components that haven't changed at all.
document.body.removeChild(tmp);
}
document.body.removeChild(tmp);
}
-function GameInfo(props) {
+const GameInfo = React.memo(props => {
if (! props.id)
return null;
if (! props.id)
return null;
>Copy Link</button>
</div>
);
>Copy Link</button>
</div>
);
-function PlayerInfo(props) {
+const PlayerInfo = React.memo(props => {
if (! props.player.id)
return null;
if (! props.player.id)
return null;
function fetch_method_json(method, api = '', data = {}) {
const response = fetch(api, {
function fetch_method_json(method, api = '', data = {}) {
const response = fetch(api, {
return fetch_method_json('PUT', api, data);
}
return fetch_method_json('PUT', api, data);
}
-class CategoryRequest extends React.Component {
+class CategoryRequest extends React.PureComponent {
constructor(props) {
super(props);
this.category = React.createRef();
constructor(props) {
super(props);
this.category = React.createRef();
-function PromptOptions(props) {
+const PromptOptions = React.memo(props => {
function handle_click(id) {
fetch_post_json(`vote/${id}`);
function handle_click(id) {
fetch_post_json(`vote/${id}`);
-class Game extends React.Component {
+class Game extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
constructor(props) {
super(props);
this.state = {