Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
Snippet for creating folder + files in vscode

For React components, I find myself following the same steps every time:

  1. Create a folder with the component name (Heading, for example)
  2. Create a Heading.js file inside this folder
  3. Create an adjacent index.js and export * from './Heading'
  4. Create a Heading.styles.js, import styled from 'styled-components' and export const Heading = styled.div (div could be whatever is appropriate)
  5. In Heading.js do something like this:
import * as S from "./Header.styles";

export function Header() {
  return <S.Header>Header</S.Header>;
}
  1. Repeat each time I create a new component

Is there a way I can create some kind of 'folder snippet' to assist this process?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use the extension File Templates (v1.5.0)

You are able to create global templates and specific templates for a project.

If you have a particular naming scheme that uses the directory name or workspace name you can add a special first line to construct the file name.

Template Component.js

##@@## ${relativeFileDirnameSplit[-1]}
import * as S from "./${relativeFileDirnameSplit[-1]}.styles";

export function ${relativeFileDirnameSplit[-1]}() {
  return <S.${relativeFileDirnameSplit[-1]}>${input:Component Header:}</S.${relativeFileDirnameSplit[-1]}>;
}

Template index.js

##@@## index
export * from './${relativeFileDirnameSplit[-1]}'

Template Component.styles.js

##@@## ${relativeFileDirnameSplit[-1]}.styles
import styled from 'styled-components'
export const ${relativeFileDirnameSplit[-1]} = styled.${input:Component styled tag:}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!