This repository was archived by the owner on Apr 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +18
-37
lines changed
packages/create-react-library/template Expand file tree Collapse file tree 4 files changed +18
-37
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
4
import ExampleComponent from '{{name}}'
5
5
6
- class App extends Component {
7
- render ( ) {
8
- return (
9
- < ExampleComponent text = 'Create React Library Example' />
10
- )
11
- }
12
- }
6
+ const App = ( ) =>
7
+ < ExampleComponent text = 'Create React Library Example' />
13
8
14
9
export default App
Original file line number Diff line number Diff line change 25
25
"peerDependencies" : {
26
26
"react" : " >=16.8"
27
27
},
28
+ {{#unless typescript }}
28
29
"dependencies" : {
29
30
"prop-types" : " ^15.7.2"
30
31
},
32
+ {{/unless }}
31
33
"devDependencies" : {
32
34
{{#if typescript }} "@types/jest" : " ^24.0.11" ,
33
35
"@types/react" : " ^16.8.13" ,
Original file line number Diff line number Diff line change 1
- import React , { Component } from 'react'
1
+ import React from 'react'
2
2
import PropTypes from 'prop-types'
3
3
4
4
import styles from './styles.css'
5
5
6
- export default class ExampleComponent extends Component {
7
- static propTypes = {
8
- text : PropTypes . string
9
- }
6
+ const ExampleComponent = ( { text } ) =>
7
+ < div className = { styles . test } > Example Component: { text } </ div >
10
8
11
- render ( ) {
12
- const {
13
- text
14
- } = this . props
15
9
16
- return (
17
- < div className = { styles . test } >
18
- Example Component: { text }
19
- </ div >
20
- )
21
- }
10
+ ExampleComponent . propTypes = {
11
+ text : PropTypes . string
22
12
}
13
+
14
+ export default ExampleComponent
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
-
3
2
import styles from './styles.css'
4
3
5
- export type Props = { text : string }
4
+ const ExampleComponent : React . FC < ExampleComponentProps > = ( { text} ) =>
5
+ < div className = { styles . test } > Example Component: { text } </ div >
6
6
7
- export default class ExampleComponent extends React . Component < Props > {
8
- render ( ) {
9
- const {
10
- text
11
- } = this . props
7
+ type ExampleComponentProps = {
8
+ text : string
9
+ }
12
10
13
- return (
14
- < div className = { styles . test } >
15
- Example Component: { text }
16
- </ div >
17
- )
18
- }
19
- }
11
+ export default ExampleComponent
You can’t perform that action at this time.
0 commit comments