How to declare defaultProps on a React component class using TypeScript?

Posted by Jennifer | Updated on

Want to declare defaultProps on a React component class using TypeScript? You can define default props this way:

This is equivalent in TypeScript to defining defaultProps as a static field inside the class body:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers