File tree 3 files changed +19
-29
lines changed
3 files changed +19
-29
lines changed Original file line number Diff line number Diff line change 1
- import React , { Component } from 'react' ;
1
+ import React from 'react' ;
2
2
import './App.css' ;
3
3
4
- import ExampleComponent from '{{name}}' ;
4
+ import { ExampleComponent } from '{{name}}' ;
5
5
6
- class App extends Component {
7
- render ( ) {
8
- return < ExampleComponent text = 'Modern React component module' /> ;
9
- }
10
- }
6
+ const App = ( ) => {
7
+ return < ExampleComponent text = 'Modern React component module' /> ;
8
+ } ;
11
9
12
10
export default App ;
Original file line number Diff line number Diff line change 1
- import React , { Component } from 'react'
2
- import PropTypes from 'prop-types'
1
+ import React from 'react' ;
2
+ import PropTypes from 'prop-types' ;
3
3
4
- import styles from './styles.css'
4
+ import styles from './styles.css' ;
5
5
6
- export default class ExampleComponent extends Component {
7
- static propTypes = {
8
- text : PropTypes . string
9
- }
6
+ export const ExampleComponent = ( ) => {
7
+ const { text } = this . props ;
10
8
11
- render ( ) {
12
- const {
13
- text
14
- } = this . props
9
+ return < div className = { styles . test } > Example Component: { text } </ div > ;
10
+ } ;
15
11
16
- return (
17
- < div className = { styles . test } >
18
- Example Component: { text }
19
- </ div >
20
- )
21
- }
22
- }
12
+ ExampleComponent . propTypes = {
13
+ text : PropTypes . string
14
+ } ;
Original file line number Diff line number Diff line change 1
- import ExampleComponent from './'
1
+ import { ExampleComponent } from './' ;
2
2
3
3
describe ( 'ExampleComponent' , ( ) => {
4
4
it ( 'is truthy' , ( ) => {
5
- expect ( ExampleComponent ) . toBeTruthy ( )
6
- } )
7
- } )
5
+ expect ( ExampleComponent ) . toBeTruthy ( ) ;
6
+ } ) ;
7
+ } ) ;
You can’t perform that action at this time.
0 commit comments