From 9013ea38ca549245442ef18aac199f9431973b60 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Wed, 20 Feb 2019 23:36:30 +0300
Subject: Refactor memo components
---
vnext/src/components/Avatar.js | 9 ---------
vnext/src/components/Button.js | 4 +++-
vnext/src/components/Contact.js | 10 ++++++----
vnext/src/components/Settings.js | 2 +-
4 files changed, 10 insertions(+), 15 deletions(-)
(limited to 'vnext/src/components')
diff --git a/vnext/src/components/Avatar.js b/vnext/src/components/Avatar.js
index 660847f2..6e56cfc2 100644
--- a/vnext/src/components/Avatar.js
+++ b/vnext/src/components/Avatar.js
@@ -66,15 +66,6 @@ class Avatar extends React.Component {
export default Avatar;
-export const AvatarLink = React.memo(props => {
- return (
-
-
- {props.user.uname}
-
- );
-});
-
Avatar.propTypes = {
user: UserType,
link: PropTypes.string,
diff --git a/vnext/src/components/Button.js b/vnext/src/components/Button.js
index 4152108b..18cab0a7 100644
--- a/vnext/src/components/Button.js
+++ b/vnext/src/components/Button.js
@@ -2,8 +2,10 @@ import React from 'react';
import './Button.css';
-export default function Button(props) {
+function Button(props) {
return (
);
}
+
+export default React.memo(Button);
diff --git a/vnext/src/components/Contact.js b/vnext/src/components/Contact.js
index dd68d338..24aabe15 100644
--- a/vnext/src/components/Contact.js
+++ b/vnext/src/components/Contact.js
@@ -1,19 +1,21 @@
import React from 'react';
+import PropTypes from 'prop-types';
import { UserType } from './Types';
import Avatar from './Avatar';
-const Contact = React.memo(({ user, style, ...rest }) => {
+function Contact({ user, style, ...rest }) {
return (
{user.unreadCount && {user.unreadCount}}
{user.lastMessageText}
);
-});
+}
-export default Contact;
+export default React.memo(Contact);
Contact.propTypes = {
- user: UserType
+ user: UserType,
+ style: PropTypes.object
};
diff --git a/vnext/src/components/Settings.js b/vnext/src/components/Settings.js
index ea632073..39489aa3 100644
--- a/vnext/src/components/Settings.js
+++ b/vnext/src/components/Settings.js
@@ -10,7 +10,7 @@ import { UserType } from './Types';
import Button from './Button';
import Icon from './Icon';
import UploadButton from './UploadButton';
-import Avatar, { AvatarLink } from './Avatar';
+import Avatar from './Avatar';
export default class Settings extends React.Component {
constructor(props) {
--
cgit v1.2.3