Moving propTypes into class definitions
This commit is contained in:
parent
60449249d0
commit
bf44bce954
@ -15,6 +15,16 @@ class App extends React.PureComponent {
|
||||
render: {}
|
||||
}
|
||||
|
||||
propTypes = {
|
||||
syntax: PropTypes.string,
|
||||
expr: PropTypes.string,
|
||||
permalinkUrl: PropTypes.string,
|
||||
syntaxList: PropTypes.arrayOf(PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
label: PropTypes.string
|
||||
}))
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.props.expr) {
|
||||
this.handleRender();
|
||||
@ -144,14 +154,4 @@ class App extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
App.propTypes = {
|
||||
syntax: PropTypes.string,
|
||||
expr: PropTypes.string,
|
||||
permalinkUrl: PropTypes.string,
|
||||
syntaxList: PropTypes.arrayOf(PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
label: PropTypes.string
|
||||
}))
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
@ -11,6 +11,20 @@ class Form extends React.PureComponent {
|
||||
syntax: this.props.syntax
|
||||
}
|
||||
|
||||
propTypes = {
|
||||
expr: PropTypes.string,
|
||||
syntax: PropTypes.string,
|
||||
syntaxList: PropTypes.arrayOf(PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
label: PropTypes.string
|
||||
})),
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
PropTypes.node
|
||||
])
|
||||
}
|
||||
|
||||
handleSubmit = event => {
|
||||
event.preventDefault();
|
||||
|
||||
@ -63,18 +77,4 @@ class Form extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
Form.propTypes = {
|
||||
expr: PropTypes.string,
|
||||
syntax: PropTypes.string,
|
||||
syntaxList: PropTypes.arrayOf(PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
label: PropTypes.string
|
||||
})),
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
PropTypes.node
|
||||
])
|
||||
};
|
||||
|
||||
export default Form;
|
||||
|
@ -14,6 +14,15 @@ class FormActions extends React.PureComponent {
|
||||
pngLink: null
|
||||
}
|
||||
|
||||
propTypes = {
|
||||
permalinkUrl: PropTypes.string,
|
||||
imageDetails: PropTypes.shape({
|
||||
svg: PropTypes.string,
|
||||
width: PropTypes.number,
|
||||
height: PropTypes.number
|
||||
})
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { imageDetails } = this.props;
|
||||
|
||||
@ -80,13 +89,4 @@ class FormActions extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
FormActions.propTypes = {
|
||||
permalinkUrl: PropTypes.string,
|
||||
imageDetails: PropTypes.shape({
|
||||
svg: PropTypes.string,
|
||||
width: PropTypes.number,
|
||||
height: PropTypes.number
|
||||
})
|
||||
};
|
||||
|
||||
export default FormActions;
|
||||
|
@ -6,6 +6,11 @@ import PlaceholderIcon from 'react-feather/dist/icons/file-text';
|
||||
import style from './style.module.css';
|
||||
|
||||
class Render extends React.PureComponent {
|
||||
propTypes = {
|
||||
expr: PropTypes.string,
|
||||
onRender: PropTypes.func.isRequired
|
||||
}
|
||||
|
||||
svgContainer = React.createRef()
|
||||
|
||||
provideSVGData() {
|
||||
@ -42,9 +47,4 @@ class Render extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
Render.propTypes = {
|
||||
expr: PropTypes.string,
|
||||
onRender: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default Render;
|
||||
|
@ -9,6 +9,13 @@ class SentryBoundary extends React.Component {
|
||||
hasError: false
|
||||
}
|
||||
|
||||
propTypes = {
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
PropTypes.node
|
||||
]).isRequired
|
||||
}
|
||||
|
||||
static getDerivedStateFromError() {
|
||||
return { hasError: true };
|
||||
}
|
||||
@ -33,11 +40,4 @@ class SentryBoundary extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
SentryBoundary.propTypes = {
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
PropTypes.node
|
||||
]).isRequired
|
||||
};
|
||||
|
||||
export default SentryBoundary;
|
||||
|
Loading…
Reference in New Issue
Block a user