Category: React
ReactJS : Generic OnChange Event Handler for TextBox in Typescript
If you have a ReactJS component with multiple textboxes, you don’t want to create multiple event handlers for updating state. Here is a way to use a generic OnChange event handler for all textboxes.
ReactJS/Typescript Error Solved: Cannot Find Name
When we use ReactJS functional component with props, it throws following error: Here is a code sample that generates the error. This in fact is not a ReactJS error. It is a Typescript error. By mistake I defined data type “string” for variable “heading” two times and hence it was causing an issue. Here is…
How to Create ReactJS TypeScript Component with State without Props
When we use ReactJS, the first argument for component requires props. but if we don’t have props and only state, here is a way to define component. Technically we are creating props object but it does not have any property.
ReactJS Error Solved: Type Children is Not Assignable to Type IntrinsicAttributes
When you are trying to create a React Component with strongly typed props you may get this error. This means that you are trying to use component with children and you did not provide any child element. In above code, it is expecting children because you are not using self closing tag. If you are…