TypeScript React.FC confusion

Function ComponentsThese can be written as normal functions that take a props argument and return a JSX element. What about React.FC/React.FunctionComponent? You can also write components with React.FunctionComponent (or the shorthand React.FC): Some differences from the “normal function” version: It provides typechecking and autocomplete for static properties like displayName, propTypes, and defaultProps – However, there are currently known issues using defaultProps with React.FunctionComponent. See this issue for details … Read more

Open a URL in a new tab (and not a new window)

Nothing an author can do can choose to open in a new tab instead of a new window; it is a user preference. (Note that the default user preference in most browsers is for new tabs, so a trivial test on a browser where that preference hasn’t been changed will not demonstrate this.) CSS3 proposed target-new, but the … Read more

Remove element by id

The DOM is organized in a tree of nodes, where each node has a value, along with a list of references to its child nodes. So element.parentNode.removeChild(element) mimics exactly what is happening internally: First you go the parent node, then remove the reference to the child node. As of DOM4, a helper function is provided to do … Read more