Skip to content

Commit 09902c7

Browse files
committed
refactor UserCard comp to functional comp
1 parent e277b67 commit 09902c7

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/Components/Panel/UserCard/UserCard.jsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
import { Component } from 'react'
2-
31
// import other component
42
import UserProfile from '../UserProfile/UserProfile'
53
import SideBarLinks from '../SideBarLinks/SideBarLinks'
64

75
// import other pkg
86
import PropTypes from 'prop-types'
9-
class UserCard extends Component {
10-
render() {
11-
const { sidebarLinks, username, userBirthday, userEmail, onChangeToggle } = this.props
12-
return (
13-
<>
14-
<UserProfile username={username} userBirthday={userBirthday} userEmail={userEmail} />
15-
<SideBarLinks sidebarLinks={sidebarLinks} onChangeToggle={onChangeToggle} />
16-
</>
17-
)
18-
}
7+
8+
const UserCard = ({ sidebarLinks, username, userBirthday, userEmail, onChangeToggle }) => {
9+
return (
10+
<>
11+
<UserProfile username={username} userBirthday={userBirthday} userEmail={userEmail} />
12+
<SideBarLinks sidebarLinks={sidebarLinks} onChangeToggle={onChangeToggle} />
13+
</>
14+
)
1915
}
2016

2117
// validate the component

src/Components/Panel/UserProfile/UserProfile.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { PureComponent } from 'react';
2-
31
// import styles of this component
42
import styles from './UserProfile.module.css'
53
// import other pkgs

0 commit comments

Comments
 (0)