Using styled-components with props and TypeScript

There have been some recent developments and with a new version of Typescript (eg. 3.0.1) and styled-components (eg. 3.4.5) there’s no need for a separate helper. You can specify the interface/type of your props to styled-components directly. interface Props { onPress: any; src: any; width: string; height: string; } const Icon = styled.Image<Props>` width: ${p … Read more

Warning: Prop `className` did not match. when using styled components with semantic-ui-react

This warning was fixed for me by adding an .babelrc file in the project main folder, with the following content: { “presets”: [“next/babel”], “plugins”: [[“styled-components”, { “ssr”: true }]] } See following link for an example: https://github.com/nblthree/nextjs-with-material-ui-and-styled-components/blob/master/.babelrc

What is the purpose of template literals (backticks) following a function in ES6?

These are tagged template literals. The part before the backpacks is a reference to a function that will be called to process the string. The function is passed the variables (the ${} parts) as arguments as well as the pieces of the string that surround the variables broken into an array. The return value of … Read more