How to make vs code autocomplete React component's prop types? How to make vs code autocomplete React component's prop types? reactjs reactjs

How to make vs code autocomplete React component's prop types?


There is also option to use @params definition:

/** *  * @param {{header: string, subheader: string, imageAlt: string, contentList: Array, orderLink: Object, contentLink: Object}} props  */export default function JumbotronMain(props) {...}

enter image description here


I noticed that if you have a stateless component and you get the props using ES6, when you use this component, you get the props with the autocomplete.

const Stateless = ({ prop1, prop2 }) => {  return (    <div></div>  )}

img


You can also get intellisense support from PropTypes. You'll need to install prop-types

import React from "react"import PropTypes from 'prop-types';function Header(props) {  return <h1>{props.headerText}</h1>}Header.propTypes = {    headerText: PropTypes.string.isRequired}export default Header

example of intellisense