Skip to content

Commit e663c45

Browse files
author
Antonio Contreras LEMONCODE
committed
Refactor components
1 parent 19777bb commit e663c45

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
import React from 'react';
2+
import { useHistory } from 'react-router-dom';
3+
import { routes } from 'core/router';
24

35
export const ProjectListComponent: React.FunctionComponent = () => {
4-
return <h1>Hello Project List component</h1>;
6+
const history = useHistory();
7+
const goToProject = (
8+
event: React.MouseEvent<HTMLParagraphElement, MouseEvent>
9+
) => {
10+
event.preventDefault();
11+
history.push({
12+
pathname: routes.editProject('1'),
13+
});
14+
};
15+
return (
16+
<>
17+
<h1>Hello Project list component</h1>
18+
<p onClick={goToProject}>Go to edit project component</p>
19+
</>
20+
);
521
};
Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
import React from 'react';
2-
import { useHistory } from 'react-router-dom';
3-
import { routes } from 'core/router';
42

53
export const ProjectComponent: React.FunctionComponent = () => {
6-
const history = useHistory();
7-
const goToProject = (
8-
event: React.MouseEvent<HTMLParagraphElement, MouseEvent>
9-
) => {
10-
event.preventDefault();
11-
history.push({
12-
pathname: routes.editProject('1'),
13-
});
14-
};
15-
return (
16-
<>
17-
<h1>Hello Edit project component</h1>
18-
<p onClick={goToProject}>Go to edit project component</p>
19-
</>
20-
);
4+
return <h1>Hello Edit project component</h1>;
215
};

0 commit comments

Comments
 (0)