File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React from 'react' ;
2+ import { useHistory } from 'react-router-dom' ;
3+ import { routes } from 'core/router' ;
24
35export 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} ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import { useHistory } from 'react-router-dom' ;
3- import { routes } from 'core/router' ;
42
53export 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} ;
You can’t perform that action at this time.
0 commit comments