Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

How to use Styled-Components

// INSTALL:
npm install --save styled-components

// IMPORT: i prefer to create a file for each component. Ex.: Button-Styled.js 
// (rather than a single file with all styled components, gets messy)
import styled from 'styled-components'

// USE: create a new file called componentName-Styled.js
// define a var with the name of the component = styled.htmltag`CSS styles`
const Button = styled.button`
  background: transparent;
  border-radius: 3px;
  border: 2px solid palevioletred;
  color: palevioletred;
  margin: 0 1em;
  padding: 0.25em 1em;
`
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #How
ADD COMMENT
Topic
Name
5+8 =