Skip to content

Instantly share code, notes, and snippets.

@ikr4-m
Created February 9, 2020 05:29
Show Gist options
  • Save ikr4-m/09d722cf95e9915cc1f5f28f4b1f6ca3 to your computer and use it in GitHub Desktop.
Save ikr4-m/09d722cf95e9915cc1f5f28f4b1f6ca3 to your computer and use it in GitHub Desktop.
How to make JSDoc for React Component
import React, { Component } from 'react'
/**
* @typedef Props - Test typedef props
* @property {boolean} [mantap] - Mantap ga?
*
* @typedef State - Test typedef state
* @property {number} itung - Angka
*
* @extends {Component<Props, State>}
*/
export default class App extends Component {
constructor (props) {
super(props)
this.state = {
itung: 0
}
}
render () {
return (
<div className='app'>
<h1>Hello world</h1>
<h1>
{this.props.mantap || 'Mantap bosku'}
</h1>
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment