File tree 3 files changed +35
-1
lines changed 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
+ import { Characters } from './ui/Characters/' ;
2
3
3
4
const App = ( ) => {
4
- return < div > Frontend DDD example demo</ div > ;
5
+ return (
6
+ < div >
7
+ < h2 > Frontend DDD example demo</ h2 >
8
+ < Characters />
9
+ </ div >
10
+ ) ;
5
11
} ;
6
12
7
13
export default App ;
Original file line number Diff line number Diff line change
1
+ import React , { useEffect } from 'react' ;
2
+ import useDomain from '../hooks/useDomain' ;
3
+
4
+ const Characters = ( ) => {
5
+ const { loading, data, executeUseCase } = useDomain ( 'list_all_characters' ) ;
6
+
7
+ useEffect ( ( ) => {
8
+ executeUseCase ( ) ;
9
+ } , [ ] ) ;
10
+
11
+ return (
12
+ < div style = { { display : 'flex' , flexWrap : 'wrap' } } >
13
+ { loading && < p > Loading characters...</ p > }
14
+ { data &&
15
+ data . map ( character => (
16
+ < div key = { character . id } >
17
+ < img src = { character . image } alt = { character . name } />
18
+ { character . name }
19
+ </ div >
20
+ ) ) }
21
+ </ div >
22
+ ) ;
23
+ } ;
24
+
25
+ export default Characters ;
Original file line number Diff line number Diff line change
1
+ import Characters from './characters' ;
2
+
3
+ export { Characters } ;
You can’t perform that action at this time.
0 commit comments