React Props Intellisense - Autocomplete

React Props Intellisense - Autocomplete

Andrew Velez
Posted on 4/5/2020Last Modified: 4/5/2020


Too Busy for Video?


Thats okay :) I won't go through everything i go through in the video but I'm sharing 2 ways you can do Auto Complete.

Its useful to be able to autocomplete react props because then you can easily know what props are available to you and in the future know what the hell you were thinking when you made those props. In all seriousness though this should be a huge time saver.

Defining 1


 // Typedef the props.
/**
 * @typedef HomeProps
 * @property {string} test Display text.
 */

/**
* @description
* @param {HomeProps} props The props passed in by Parent.
*/
function Home(props) {
  return <div />;
}


Defining 2


/**
* @description
* @param {Home.propTypes} props The props passed in by Parent.
*/
function Home(props) {
  return <div />;
}

Home.propTypes = {
  test: Proptypes.string.isRequired
};

End Result


If you want a more detailed explanation including how to do documentation for the props and how to do this when inheriting a React class, check out the video above.

Andrew Velez
Posted on 4/5/2020Last Modified: 4/5/2020

...

Recomendations

Games for Sale

Comments 0

Display Name

Email


0 / 10