Skip to main content

Command Palette

Search for a command to run...

Let's talk about “tagged template literals"

Updated
1 min readView as Markdown
Let's talk about “tagged template literals"
import styled from 'styled-components';

const Button = styled.button``;

That certainly is a super weird syntax and chances are you haven't seen that before , this is called a tagged template literal. it's a default JavaScript feature, it's not specific to react , u could use it in any Javascript project. And now what does this do? button is simply a method on this styled object , and Styled is an object we are importing from style components , and there we can access the button method. it's just a special kind of method you could say.

More from this blog

Omar's blog

135 posts