<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ant The Developer</title>
    <description>The latest articles on DEV Community by Ant The Developer (@antjanus).</description>
    <link>https://dev.to/antjanus</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2054%2Fb36a756d-a6f9-4600-9772-7daa944922c8.jpg</url>
      <title>DEV Community: Ant The Developer</title>
      <link>https://dev.to/antjanus</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/antjanus"/>
    <language>en</language>
    <item>
      <title>Agentic AI Glossary Cheatsheet</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Thu, 15 Jan 2026 23:09:00 +0000</pubDate>
      <link>https://dev.to/antjanus/agentic-ai-glossary-cheatsheet-4jd1</link>
      <guid>https://dev.to/antjanus/agentic-ai-glossary-cheatsheet-4jd1</guid>
      <description>&lt;p&gt;Quick reference guide for Claude Code and agentic AI terminology. I have a longer &lt;a href="https://antjanus.com/ai/ai-glossary" rel="noopener noreferrer"&gt;ai glossary for claude code&lt;/a&gt; on my personal blog.&lt;/p&gt;

&lt;h2&gt;
  
  
  📃 Quick Reference
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Skill
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What:&lt;/strong&gt; Auto-invoking function registered with your tool&lt;br&gt;
&lt;strong&gt;Location:&lt;/strong&gt; &lt;code&gt;./claude/skills/[skill-name]/SKILL.md&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Run:&lt;/strong&gt; &lt;code&gt;/my-skill-name&lt;/code&gt; (also, runs automatically)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;build-component&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build a React component with tests and stories&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

Instructions for building the component...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Subagent
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What:&lt;/strong&gt; Specialized agent controlled by your main agent&lt;br&gt;
&lt;strong&gt;Location:&lt;/strong&gt; &lt;code&gt;./claude/agents/[agent-name]/&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Create:&lt;/strong&gt; &lt;code&gt;/agents&lt;/code&gt; command in Claude Code&lt;br&gt;
&lt;strong&gt;Run:&lt;/strong&gt; runs automatically&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;documentation-creator&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Creates easy-to-read documentation&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

You are a documentation writer...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Command (Deprecated)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What:&lt;/strong&gt; Slash command shortcuts (use Skills instead)&lt;br&gt;
&lt;strong&gt;Location:&lt;/strong&gt; &lt;code&gt;.claude/commands/review.md&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Run:&lt;/strong&gt; &lt;code&gt;/review&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔑 Term Definitions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Skill
&lt;/h3&gt;

&lt;p&gt;A special file (&lt;code&gt;SKILL.md&lt;/code&gt;) that describes an action Claude Code can take. Think of it as an auto-invoking function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key points:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Auto-loads based on name and description&lt;/li&gt;
&lt;li&gt;Entry point is always &lt;code&gt;SKILL.md&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Can include templates, scripts, and examples&lt;/li&gt;
&lt;li&gt;Auto-runs without explicit invocation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use for:&lt;/strong&gt; Repeated tasks, component generation, documentation, custom scripts&lt;/p&gt;

&lt;h3&gt;
  
  
  Subagent
&lt;/h3&gt;

&lt;p&gt;Another instance of an agent controlled by a higher-up agent. Agent = LLM + Tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key points:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agents can have multiple subagents&lt;/li&gt;
&lt;li&gt;Built-in subagents for exploration, planning, multi-step operations&lt;/li&gt;
&lt;li&gt;Autonomous workers with their own context/prompt&lt;/li&gt;
&lt;li&gt;Respond to the controlling agent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use for:&lt;/strong&gt; Code exploration, planning implementations, multi-step workflows, custom automation&lt;/p&gt;

&lt;h3&gt;
  
  
  Command (Deprecated - Use Skills)
&lt;/h3&gt;

&lt;p&gt;Slash commands that trigger predefined prompts or system functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key points:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always start with &lt;code&gt;/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Built-in commands handle system functions&lt;/li&gt;
&lt;li&gt;Custom commands are Markdown files with prompts&lt;/li&gt;
&lt;li&gt;MCP servers can expose prompts as slash commands&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use for:&lt;/strong&gt; Repeated prompts, project conventions, quick actions, consistency&lt;/p&gt;

&lt;h3&gt;
  
  
  MCP (Model Context Protocol)
&lt;/h3&gt;

&lt;p&gt;Open standard for standardizing how AI systems integrate with external tools and data sources. MCP servers enable integrations between tooling like claude code and external services like Jira or GitHub.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key points:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open standard (not proprietary)&lt;/li&gt;
&lt;li&gt;Two-way communication (read and write)&lt;/li&gt;
&lt;li&gt;Pre-built servers for popular tools (GitHub, Slack, Postgres)&lt;/li&gt;
&lt;li&gt;Cross-platform SDKs (Python, TypeScript)&lt;/li&gt;
&lt;li&gt;Adopted by OpenAI, Google DeepMind, and others&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use for:&lt;/strong&gt; Data access, tool integration, enterprise systems, cross-tool workflows&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 Comparison Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Skill&lt;/th&gt;
&lt;th&gt;Subagent&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;MCP&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Purpose&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Reusable actions&lt;/td&gt;
&lt;td&gt;Autonomous task execution&lt;/td&gt;
&lt;td&gt;Shortcuts&lt;/td&gt;
&lt;td&gt;External integrations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Auto-runs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;❌ Manual&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Location&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;./claude/skills/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;./claude/agents/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;.claude/commands/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;External servers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;File&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;SKILL.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Agent definition&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;.md&lt;/code&gt; file&lt;/td&gt;
&lt;td&gt;Server config&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Status&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ Current&lt;/td&gt;
&lt;td&gt;✅ Current&lt;/td&gt;
&lt;td&gt;⚠️ Deprecated&lt;/td&gt;
&lt;td&gt;✅ Current&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  📚 Resources
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Skills:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/skills" rel="noopener noreferrer"&gt;Skills Documentation - Claude Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Subagents:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/sub-agents" rel="noopener noreferrer"&gt;Create custom subagents - Claude Code Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://claude.com/solutions/agents" rel="noopener noreferrer"&gt;AI agents | Claude&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Commands:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/slash-commands" rel="noopener noreferrer"&gt;Slash commands - Claude Code Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://shipyard.build/blog/claude-code-cheat-sheet/" rel="noopener noreferrer"&gt;Claude Code CLI Cheatsheet&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;MCP:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://modelcontextprotocol.io/specification/2025-11-25" rel="noopener noreferrer"&gt;Model Context Protocol Specification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/news/model-context-protocol" rel="noopener noreferrer"&gt;Introducing MCP - Anthropic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/modelcontextprotocol" rel="noopener noreferrer"&gt;MCP GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;For detailed explanations, see the &lt;a href="https://antjanus.com/ai/ai-glossary" rel="noopener noreferrer"&gt;full AI Glossary&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agentic</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Prompt Posts: Sharing AI Prompts Through Blog Posts</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Thu, 15 Jan 2026 16:54:59 +0000</pubDate>
      <link>https://dev.to/antjanus/prompt-posts-sharing-ai-prompts-through-blog-posts-5gbl</link>
      <guid>https://dev.to/antjanus/prompt-posts-sharing-ai-prompts-through-blog-posts-5gbl</guid>
      <description>&lt;p&gt;Right now, if you were to create a reusable public prompt, your best bet is using Github and checking the prompt in there. In fact, there are quite a few repos with reusable prompts and all you need to do is search "github [toolname] prompts" and you'll get a great starting list.&lt;/p&gt;

&lt;p&gt;My issue is that majority of prompts require their own assessment and tweaking and whatever else to make it work for &lt;em&gt;you&lt;/em&gt;. I don't believe most devs check these prompts, read them, or modify them which creates the issue that these prompts aren't as effective as they could be.&lt;/p&gt;

&lt;p&gt;So I had this idea, what if instead of "prompts", we create a prompt to create prompts? And what if these directions were written for a human rather than AI? &lt;/p&gt;

&lt;p&gt;That's when it hit me, there's a huge wealth of tutorials, guides, etc. that an AI agent could read to generate prompts. What struck me as the next obvious step would be to write a tutorial/guide that a human could follow and an AI could use to generate a prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why reusable prompts in the first place?
&lt;/h2&gt;

&lt;p&gt;I think this is an easy question to answer because the answer is the same as why we'd want to isolate and create libraries, create open source code, etc.&lt;/p&gt;

&lt;p&gt;Reusable prompts are powerful because they can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;keep AI behavior more consistent across codebases/uses&lt;/li&gt;
&lt;li&gt;get a better starting point for more focused prompts&lt;/li&gt;
&lt;li&gt;enable various common functionalities between codebases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I mean, why not? Being able to port skills, agent definitions, etc. across codebases is great. Being able to keep the same coding standards is the same thing. I'm very much in favor it.&lt;/p&gt;

&lt;h2&gt;
  
  
  So why blog posts?
&lt;/h2&gt;

&lt;p&gt;I wrote a blog post on &lt;a href="https://antjanus.com/ai/claude-code-best-practices" rel="noopener noreferrer"&gt;best practices for AI-assisted coding&lt;/a&gt; as a test for how blog posts could work for prompt generation. The post is essentially a large prompt for an AI tool to use for prompt generation &lt;em&gt;with&lt;/em&gt; explanations and step by step instructions for the developers utilizing it.&lt;/p&gt;

&lt;p&gt;There are essentially two reasons why you'd want to have this "pre-prompt" with a human explanation instead of static prompts in Github.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Human Aspect
&lt;/h3&gt;

&lt;p&gt;With AI/agentic coding gaining traction as a productivity tool, it's easy to forget that at &lt;em&gt;some&lt;/em&gt; point a human has to be involved. It won't be claude code running its first &lt;code&gt;/init&lt;/code&gt;, it'll be a dev (or an agent setup by a dev). The first prompts in a repository will most likely be auto-generated but if you really want to get good value from a properly setup &lt;code&gt;CLAUDE.md&lt;/code&gt; or an &lt;code&gt;AGENTS.md&lt;/code&gt;, a &lt;em&gt;human&lt;/em&gt; will need to be involved in the process.&lt;/p&gt;

&lt;p&gt;With that said, that dev may very likely prompt Claude, OpenCode, or whatever other tool like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Setup appropriate prompts for this repository. Research prompting best practices. Utilize open source prompts such as the prompts from [some] company.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And be happy with the initial output. However, there will be very little understanding of why prompts are setup the way they are, why those best practices exist. If a developer then keeps up with best practices by themselves, they'll still need to prompt their tool appropriately based on what they've learned.&lt;/p&gt;

&lt;p&gt;As a hybrid approach, and a nod to &lt;a href="https://en.wikipedia.org/wiki/Literate_programming" rel="noopener noreferrer"&gt;literate programming&lt;/a&gt;, I created a blog post that a developer can read so that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;they can understand why the final prompt looks the way it does&lt;/li&gt;
&lt;li&gt;they can learn best practices along the way&lt;/li&gt;
&lt;li&gt;they have a reference on how to fix possible issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With a developer having this understanding, writing and fixing prompts should be a lot more straightforward. I'll draw a parallel to reading library documentation when you're hand-coding.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Pre-Prompt
&lt;/h3&gt;

&lt;p&gt;By utilizing the aforementioned blog post as a prompt for generating prompts, you end up with several adventages including your AI understanding how to customize the prompt for your specific codebase and usecase. It can function as a much better-suited prompt for your codebase in comparison to doing a raw &lt;code&gt;/init&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;The AI will be able to digest hints to do research on what libraries are used, what's deprecated, and much more. A copied prompt can't do that much heavy lifting. Since the article is public, you can reuse this pre-prompt for any codebase and even use it to ask your favorite AI tool to adjust its current prompt according to those criteria specified within.&lt;/p&gt;

&lt;p&gt;All in all, it's just a better approach to creating prompts.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This is the case &lt;em&gt;right now&lt;/em&gt;. I've heard of quite a few users that don't even use &lt;code&gt;CLAUDE.md&lt;/code&gt; or use a very thin prompt with a lot of success. That hasn't been my experience but, obviously, we're living in the wild west of AI prompting right now.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Prompts as Public Knowledge
&lt;/h2&gt;

&lt;p&gt;If you're not sold on having public blog posts that function this way, then let me make my argument here. &lt;/p&gt;

&lt;p&gt;Publishing blog posts publicly accomplishes several things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A blog post about "How to Prompt Claude Code for Svelte Components" is easily searchable, linkable, and it can be referenced in discussions and shared with colleagues (across companies/jobs)

&lt;ul&gt;
&lt;li&gt;it also provides a super easy way for your AI to see it without requiring auth or access to a folder or what have you&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;When you publish a prompt, you're inviting others to critique it and provide their own expertise to help improve it&lt;/li&gt;

&lt;li&gt;It creates documentation -- A good blog post about a prompt explains &lt;em&gt;why&lt;/em&gt; the prompt is structured that way. It explains what problems it solves. It serves as documentation for future use.&lt;/li&gt;

&lt;li&gt;It's readily accessible for new projects&lt;/li&gt;

&lt;li&gt;It contributes to the collective knowledge. The AI ecosystem is young. When you share what works, you're helping others avoid the trial-and-error phase you went through.&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating your own
&lt;/h2&gt;

&lt;p&gt;I'm not against using Github at all. Publishing prompt blog posts (&lt;code&gt;prompt post&lt;/code&gt;?) on Github may be even a better idea than doing that on a blogging platform; however, I find that Github changes your perception of the prompt post and makes it seem more like &lt;em&gt;just a prompt&lt;/em&gt;, eliminating the human aspect.&lt;/p&gt;

&lt;p&gt;Creating the prompt post itself isn't terribly difficult. I think the parallel to literate programming is key here. You're writing a post and you're explaining a "template" for the final prompt in easily-digestible parts. I generally like to structure these as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Description&lt;/span&gt;

Explain what the resulting prompt should do and why.

&lt;span class="gu"&gt;## Core Logic&lt;/span&gt;

Core logic of the prompt goes here along with explanations of each part.

&lt;span class="gu"&gt;### Standards&lt;/span&gt;

For example, this section would explain coding standards such as using or not using classes in your TypeScript code, usage of &lt;span class="sb"&gt;`any`&lt;/span&gt;, and similar.

&lt;span class="se"&gt;\`\`\`&lt;/span&gt;
&lt;span class="gu"&gt;## Standards&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; DO use Enums for any options, variants, etc.
&lt;span class="p"&gt;
-&lt;/span&gt; DO NOT use &lt;span class="sb"&gt;`any`&lt;/span&gt; in TypeScript code
&lt;span class="p"&gt;-&lt;/span&gt; DO NOT use classes
&lt;span class="se"&gt;\`\`\`&lt;/span&gt;

&lt;span class="gu"&gt;## Expected output&lt;/span&gt;

Ensure that you always tell your AI your expectations.

&lt;span class="se"&gt;\`\`\`&lt;/span&gt;
&lt;span class="gu"&gt;## Output&lt;/span&gt;

Create documentation for coding standards in this codebase
&lt;span class="se"&gt;\`\`\`&lt;/span&gt;

&lt;span class="gu"&gt;## Conclusion/More Resources&lt;/span&gt;

List out any resources or tips on how to handle certain situations, how to extend the resulting prompt, or list out links to further helpful resources
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this basic structure, you should be able to create a robust prompt post that you, your team, and your AI can fully utilize.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about you?
&lt;/h2&gt;

&lt;p&gt;What's worked well for you? I've used this system multiple times with unpublished pre-prompts and unfortunately, I don't have access to those anymore (should've made them public!) but this approach has worked for me time and time again to create a solid prompt start for different projects.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; One extra level of inception here would be to reference &lt;em&gt;this&lt;/em&gt; post to your AI so it could generate a starting point for your prompt post! &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>ai</category>
      <category>prompts</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Accessibility labels for content loading in React</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Mon, 22 May 2023 15:39:51 +0000</pubDate>
      <link>https://dev.to/antjanus/accessibility-labels-for-content-loading-in-react-hib</link>
      <guid>https://dev.to/antjanus/accessibility-labels-for-content-loading-in-react-hib</guid>
      <description>&lt;p&gt;I've really been enjoying learning about how to make applications and websites more accessible and recently wondered about how to appropriately label a loader for a side project React app I'm writing. After scouring &lt;a href="https://stackoverflow.com/questions/38704467/how-to-label-a-loading-animation-for-wai-aria" rel="noopener noreferrer"&gt;Stackoverflow answers&lt;/a&gt;, and looking at what &lt;a href="https://getbootstrap.com/docs/4.5/components/spinners/" rel="noopener noreferrer"&gt;Bootstrap's solution&lt;/a&gt; is, I came across &lt;a href="https://dockyard.com/blog/2020/03/02/accessible-loading-indicatorswith-no-extra-elements" rel="noopener noreferrer"&gt;an article by some company called Dockyard&lt;/a&gt;. They all conflict in different ways. Finally, I followed an SO link to &lt;a href="http://sap.github.io/techne/loading-spinner.html" rel="noopener noreferrer"&gt;Fundamental UI&lt;/a&gt;. And came up with this idea:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Loader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Loading&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;LoadContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;busy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;live&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;polite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;isLoading&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Loader&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isLoading&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's what it does (as I understand it):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.w3.org/TR/wai-aria-1.0/states_and_properties#aria-busy" rel="noopener noreferrer"&gt;aria-busy&lt;/a&gt;&lt;/strong&gt; lets us indicate that the container is in the process of updating.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.w3.org/TR/wai-aria-1.0/states_and_properties#aria-live" rel="noopener noreferrer"&gt;aria-live&lt;/a&gt;&lt;/strong&gt; lets us indicate that the element is going to updated. The &lt;code&gt;polite&lt;/code&gt; property indicates a background change (this might be a good place to add a prop to indicate if the content is main content, or background content)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.w3.org/TR/wai-aria-1.0/states_and_properties#aria-label" rel="noopener noreferrer"&gt;aria-label&lt;/a&gt;&lt;/strong&gt; lets us indicate the label for the element.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I made a &lt;a href="https://codesandbox.io/s/loader-hwwlj?file=/src/App.js" rel="noopener noreferrer"&gt;Sandbox&lt;/a&gt; where you can check this out in action.&lt;/p&gt;

&lt;p&gt;I'm still getting started with accessibility so I welcome &lt;em&gt;any&lt;/em&gt; input on this. &lt;/p&gt;

</description>
      <category>react</category>
      <category>web</category>
      <category>a11y</category>
    </item>
    <item>
      <title>What are your favorite course platforms for furthering your learning?</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Sun, 24 Apr 2022 13:50:21 +0000</pubDate>
      <link>https://dev.to/antjanus/what-are-your-favorite-course-platforms-for-furthering-your-learning-14dg</link>
      <guid>https://dev.to/antjanus/what-are-your-favorite-course-platforms-for-furthering-your-learning-14dg</guid>
      <description>&lt;p&gt;I've seen a few platforms that people have recommended to me but I've had varying success with them and have heard positives/negatives about each. I was wondering what everyone else hits up!&lt;/p&gt;

&lt;p&gt;I personally prefer courses by individuals as they seem to be higher quality (eg. Epic React). I do have an &lt;a href="https://egghead.io" rel="noopener noreferrer"&gt;egghead&lt;/a&gt; subscription but I basically never use it anymore. &lt;/p&gt;

&lt;p&gt;How about you all? &lt;/p&gt;

</description>
      <category>discuss</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The Anatomy Of My Ideal React Component</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Fri, 11 Mar 2022 18:52:02 +0000</pubDate>
      <link>https://dev.to/antjanus/the-anatomy-of-my-ideal-react-component-1lo0</link>
      <guid>https://dev.to/antjanus/the-anatomy-of-my-ideal-react-component-1lo0</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-router-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;styled-components&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;tw&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;twin.macro&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;USER_ROUTES&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useUser&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;modules/auth&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Loader&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;modules/ui&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;usePost&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;modules/posts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;EmptyFallback&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./emptyFallback&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;StyledContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="s2"&gt;`
  &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;tw&lt;/span&gt;&lt;span class="s2"&gt;`w-100 m-auto`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;
`&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;StyledHeading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="s2"&gt;`
  &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;tw&lt;/span&gt;&lt;span class="s2"&gt;`text-lg`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;
`&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;PostProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Post&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;PostProps&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;JSX&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Element&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIsExpanded&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isSuccess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;usePost&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useUser&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Loader&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isLoading&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;EmptyFallback&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;StyledContainer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;USER_ROUTES&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ACCOUNT&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Back&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Link&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;StyledHeading&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/StyledHeading&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/StyledContainer&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how I write my components and how I prefer to write React. It's a &lt;em&gt;super specific&lt;/em&gt; way that works for me - and that includes using &lt;a href="https://styled-components.com/" rel="noopener noreferrer"&gt;styled-components&lt;/a&gt;. If you have suggestions on how to improve this structure, I'm all ears. I love to improve how I do things and I greatly enjoy feedback.&lt;/p&gt;

&lt;p&gt;I'll drop questions in the article if you'd like to give me feedback on those!&lt;/p&gt;

&lt;p&gt;For anyone new to React or JS or development or TS, don't even worry about all that this is doing. I really just wanted to showcase a complicated example.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I wanted to stress this again -- this is what works for me. I'd love to hear about what works for you! &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Imports
&lt;/h2&gt;

&lt;p&gt;Does import order matter? Not really. But I like to have rules around them especially for bigger components that might have 20 lines of imports &lt;em&gt;or more&lt;/em&gt;. And that happens more than I'd like to admit. My general heuristics are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React up top no matter what&lt;/li&gt;
&lt;li&gt;3rd party library imports (followed by a new line)&lt;/li&gt;
&lt;li&gt;internal library imports (and aliased imports)&lt;/li&gt;
&lt;li&gt;local imports
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// react&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// 3rd party libraries&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;moment&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;moment&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;styled-components&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// internal shared components/utils/libraries&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ListItems&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useItems&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;modules/ui&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// local&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;EmptyFallback&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./EmptyFallback&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt; When you deal with more than a handful of imports, it's really easy to get lost in what the file is using. Having conventions around imports makes it easier for me to see what it's using at a glance&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Styled Components
&lt;/h2&gt;

&lt;p&gt;No matter what library you use, you are writing your CSS &lt;em&gt;somewhere&lt;/em&gt;. I'm a fan of styled-components (we use them at work) and &lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;Tailwind&lt;/a&gt; (I use it in personal projects). &lt;a href="https://github.com/ben-rogerson/twin.macro" rel="noopener noreferrer"&gt;Twin&lt;/a&gt; allows you to combine them together -- that way you can write custom CSS if you need to, and Tailwind is great for rapid prototyping and production-ready apps alike. Best of both worlds.&lt;/p&gt;

&lt;p&gt;I put these at the top because my components below typically use them. If there are too many styled components, I tend to put them in a co-located &lt;code&gt;styled.ts&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;I also tend to prefix styled components with &lt;code&gt;Styled&lt;/code&gt;. Something I learned at work. It quickly distinguishes between styling components and components that do more than that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;StyledContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="s2"&gt;`
  &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;tw&lt;/span&gt;&lt;span class="s2"&gt;`w-full`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;

  background-color: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;COLORS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CONTAINER_BACKGROUND&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;
`&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SomeComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// logic&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useItems&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;StyledContainer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* styled component that does nothing else */&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;List&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt; {/&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;internal&lt;/span&gt; &lt;span class="nx"&gt;logic&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/StyledContainer&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt; I prefer co-located styling but also, put these up top so they're separate from components that have more than styling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Questions for you:&lt;/strong&gt; How do you organize your styled components? If you have a file with styled components, what do you call it?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Component Types
&lt;/h2&gt;

&lt;p&gt;I typically name my Component types as &lt;code&gt;ComponentNameProps&lt;/code&gt; and &lt;code&gt;ComponentNameReturn&lt;/code&gt; where most of the time, I skip the "return" to use &lt;code&gt;JSX.Element&lt;/code&gt; (I do use the &lt;code&gt;Return&lt;/code&gt; type for hooks though! I'll write about that another day). Check out the &lt;a href="https://react-typescript-cheatsheet.netlify.app/" rel="noopener noreferrer"&gt;React TypeScript CheatSheet&lt;/a&gt; which contains majority of the conventions I use for TypeScript and React.&lt;/p&gt;

&lt;p&gt;This convention (naming and placement) makes it clear that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;this type belongs to the component&lt;/li&gt;
&lt;li&gt;this type &lt;em&gt;isn't&lt;/em&gt; shareable&lt;/li&gt;
&lt;li&gt;where to find the typing (right above the component)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It's also a stylistic choice not to inline it but you can:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// I don't like this&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SomeComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; 
  &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;isEnabled&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;onClick&lt;/span&gt;
&lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;isEnabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;
  &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;DataStructureType&lt;/span&gt;
  &lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FilterType&lt;/span&gt;
  &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt;
&lt;span class="p"&gt;}):&lt;/span&gt; &lt;span class="nx"&gt;JSX&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Element&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="c1"&gt;// I do like this&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;SomeComponentProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;isEnabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;
  &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;DataStructureType&lt;/span&gt;
  &lt;span class="na"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FilterType&lt;/span&gt;
  &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SomeComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; 
  &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;isEnabled&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;onClick&lt;/span&gt;
&lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;SomeComponentProps&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;JSX&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Element&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I feel like I have to constantly re-emphasize: this is what works for me specifically. There's no science or research behind this. It's not "easier to reason about" (which most of the time means "I like this", anyways).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt; Co-located component types right above the component declaration make it easier &lt;em&gt;for me&lt;/em&gt; to see the Component's purpose and signature at a glance&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Questions for you:&lt;/strong&gt; Do you co-locate your component types? Do you prefer inling them?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Component structure
&lt;/h2&gt;

&lt;p&gt;Ok, let's dig into the Component structure. I think components typically have the following parts to them (some more or less, depending on what you're doing):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;local state (useState, useReducer, useRef, useMemo, etc.)&lt;/li&gt;
&lt;li&gt;non-React hooks and async/state fetching stuff (react-query, apollo, custom hooks, etc.)&lt;/li&gt;
&lt;li&gt;useEffect/useLayoutEffect&lt;/li&gt;
&lt;li&gt;post-processing the setup&lt;/li&gt;
&lt;li&gt;callbacks/handlers&lt;/li&gt;
&lt;li&gt;branching path rendering (loading screen, empty screen, error screen)&lt;/li&gt;
&lt;li&gt;default/success rendering&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;More or less, but let's go through them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// local state&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIsExpanded&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// non-react hooks&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;usePost&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="c1"&gt;// useEffect&lt;/span&gt;
&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;setIsExpanded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// close expanded section when the post id changes&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="c1"&gt;// post processing&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;snippet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;generateSnippet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// callbacks and handlers&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;toggleExpanded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;setIsExpanded&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// branching path rendering&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Loading&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;StyledContainer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;snippet&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/StyledContainer&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// default/success render&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;StyledContainer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/StyledContainer&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So a few things about this, I set this up so that the logic seems to flow down and we declare as much ahead of time as possible. I think there is quite a bit of wiggle space here because what really matters is declaring variables and using hooks before we render. This is &lt;em&gt;necessary&lt;/em&gt; for hooks to work right. If you try to short-circuit a render and skip a hook as a result, React will let you know that's an issue.&lt;/p&gt;

&lt;p&gt;I also like to add the handler at the end of that declaration block so I have access to any variables I might need if I convert it to use &lt;code&gt;useCallback&lt;/code&gt;. Which is also why I use &lt;code&gt;const func = () =&amp;gt; {}&lt;/code&gt; instead of &lt;code&gt;function func() {}&lt;/code&gt; -- to quickly convert to useCallback and to avoid a mismatch of named functions and lambdas.&lt;/p&gt;

&lt;p&gt;We can then safely jump into branching path rendering for loading screens, errors, etc. without worrying about hooks. We can exit the render safely early this way. &lt;/p&gt;

&lt;p&gt;And lastly, I keep the default/success render at the bottom. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt; It's a lot to cover but honestly, it's all personal preference influenced by React's requirement to always run all hooks in a component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt; Does this differ much from your standards?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Potential For Refactor
&lt;/h2&gt;

&lt;p&gt;You might notice that my original component doesn't have a useEffect or the post-processing examples. Why is that?&lt;/p&gt;

&lt;p&gt;Typically, if I have to do some lifting in a component to get data in a specific state, or I have variables that relate to each other, I like to hide that in a hook.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;UsePostProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;UsePostReturn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;
  &lt;span class="na"&gt;post&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PostType&lt;/span&gt;
  &lt;span class="na"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;
  &lt;span class="na"&gt;toggleExpanded&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;usePost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;UsePostProps&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;UsePostReturn&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIsExpanded&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cache&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getPost&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setIsExpanded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isLoading&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nf"&gt;formatPost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="nx"&gt;toggleExpanded&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt; I'm not sure. I don't like big components, I don't like components that do too much so I split logic up into hooks however feels right to me.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt; How do you feel about wrapping API calls in custom hooks by default? eg. any unique call has its own hook that handles data transformation, related state, and the fetching. And do you prefer to have this logic inside of a component? &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Wondering about folder structure?
&lt;/h2&gt;

&lt;p&gt;I made a &lt;a href="https://www.youtube.com/watch?v=SvR0_lWkPmU" rel="noopener noreferrer"&gt;React application structure video&lt;/a&gt; on that topic. Though, in hindsight, it has a few syntax errors I didn't notice while recording.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>What are your favorite non-dev activities to do after a solid day of coding?</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Thu, 18 Feb 2021 15:32:05 +0000</pubDate>
      <link>https://dev.to/antjanus/what-are-your-favorite-non-dev-activities-to-do-after-a-solid-day-of-coding-2cp2</link>
      <guid>https://dev.to/antjanus/what-are-your-favorite-non-dev-activities-to-do-after-a-solid-day-of-coding-2cp2</guid>
      <description>&lt;p&gt;I &lt;em&gt;love&lt;/em&gt; coding but I like to also switch things up to keep my mind fresh and to relax. What do you like to do in your time off? Would you recommend it to the rest of us?&lt;/p&gt;

&lt;p&gt;I love to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;read and write fiction&lt;/li&gt;
&lt;li&gt;play games and make a podcast about it&lt;/li&gt;
&lt;li&gt;take long baths with luxury bath bombs (those that have like flower petals or little crystals in them :D )&lt;/li&gt;
&lt;li&gt;talk to my friends about my day on my Discord server's voicechat&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>7 Little Things I Learned In January</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Mon, 01 Feb 2021 15:43:23 +0000</pubDate>
      <link>https://dev.to/antjanus/7-little-things-i-learned-in-january-501e</link>
      <guid>https://dev.to/antjanus/7-little-things-i-learned-in-january-501e</guid>
      <description>&lt;p&gt;I have a dozen half-written articles on dev.to and many more scattered across the universe. It's daunting and overwhelming trying to write something &lt;em&gt;good&lt;/em&gt;. When these articles come out, I &lt;em&gt;know&lt;/em&gt; they'll be good but until I get there, I figured I'd kick off a new personal series :)&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Use JQ to get info from &lt;code&gt;package.json&lt;/code&gt; quickly
&lt;/h2&gt;

&lt;p&gt;JQ is a command line utility that can explore JSON files. When I found out just how easy this utility is to install (every package manager has it) and to use, I created two aliases to help me with every day tasks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# npmscr will print out a list of package.json scripts&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;npmscr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"jq '.scripts' package.json"&lt;/span&gt;

&lt;span class="c"&gt;# npmver will print out the package.json version&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;npmver&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"jq '.version' package.json"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. What &lt;code&gt;git pull&lt;/code&gt; does
&lt;/h2&gt;

&lt;p&gt;I had a conversation with a fellow dev about this. And honestly, even while researching this for this article, the behavior is a tad confusing.&lt;/p&gt;

&lt;p&gt;Out right, this is what &lt;code&gt;git pull&lt;/code&gt; does:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull

&lt;span class="c"&gt;# is equivalent to&lt;/span&gt;
git fetch &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git merge FETCH_HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We fetch data from remote and then merge it into our local.&lt;/p&gt;

&lt;p&gt;The confusing part to me is if &lt;code&gt;git fetch&lt;/code&gt; fetches &lt;em&gt;only&lt;/em&gt; data for our current branch or if it does a blanket &lt;code&gt;git fetch origin&lt;/code&gt; equivalent.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;code&gt;console.debug&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;I had &lt;em&gt;no&lt;/em&gt; idea about &lt;code&gt;console.debug&lt;/code&gt;. I've always used &lt;code&gt;console.log&lt;/code&gt; to log any data for debugging. The biggest difference? It shows up differently in your console!&lt;/p&gt;

&lt;p&gt;There's literally a special section (at least in chrome devtools) for debugging statements. In any application with regular logging or just a ton of random logs, this is a super easy way to split this stuff apart. &lt;/p&gt;

&lt;p&gt;Super happy that one of my colleagues showed this to me during a pairing session.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;thatOneTrickyVar&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Pair programming is a skill to be taught/learned
&lt;/h2&gt;

&lt;p&gt;It might sound obvious to some and baffling to others. I started at a new job recently and had a conversation about this with a fellow programmer and later on, with one of my friends who is just starting out. I had been so used to pairing with my colleagues, that it didn't occur to me that this &lt;em&gt;helped&lt;/em&gt; me a ton to get better at pairing.&lt;/p&gt;

&lt;p&gt;So what's there to learn? A balance between asking questions, observing, giving input, and a slew of other things.&lt;/p&gt;

&lt;p&gt;From my experience, some people tend to micro-manage in either place (as a driver or navigator...or whatever the titles are), some tend to be too hands off, some people ask too many questions and some none at all. It's really an interesting aspect of programming.&lt;/p&gt;

&lt;p&gt;I think a lot of programmers are opposed to pairing; however, the benefits of pairing &lt;em&gt;well&lt;/em&gt; are incalculable (and probably good for another article :) ). Strangely, from anecdotal experience, senior people have more issues with this than junior people.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Naming cheatsheet
&lt;/h2&gt;

&lt;p&gt;Okay, okay, probably all of you already know about the &lt;a href="https://github.com/kettanaito/naming-cheatsheet" rel="noopener noreferrer"&gt;naming cheatsheet&lt;/a&gt; that Kent C. Dodds tweeted about recently, but it's worth pointing out.&lt;/p&gt;

&lt;p&gt;It's a nice little readme specifying various naming conventions. I personally don't agree with some of them but majority of the rules specified, I &lt;em&gt;already&lt;/em&gt; follow.&lt;/p&gt;

&lt;p&gt;Conventions are extremely powerful, especially in a team setting. &lt;/p&gt;

&lt;h2&gt;
  
  
  6. Basic TypeScript typing for React
&lt;/h2&gt;

&lt;p&gt;I've used TypeScript with React only &lt;em&gt;passingly&lt;/em&gt; but I've used TypeScript quite a bit in Angular, for writing libraries, and just for fun. One thing that's always scary is figuring out the basics. They're often unavailable. So here's the gist of what I've learned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// type is `React.FC` (for "Functional Component")&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hi&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// React.FC is a generic&lt;/span&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IMyComponentProps&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ReactNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// React.ReactNode is any react node&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;IMyComponentProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="nx"&gt;children&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt; &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hi&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. You can run Cypress without a server
&lt;/h2&gt;

&lt;p&gt;I've been used to writing &lt;a href="https://cypress.io" rel="noopener noreferrer"&gt;Cypress tests&lt;/a&gt; as e2e tests where I had full ability to run a backend server. I recently found out that it's fairly straightforward to write mocks in Cypress.&lt;/p&gt;

&lt;p&gt;Using routes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mockResponse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api/actual/endpoint&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mockResponse&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax allows for all kinds of specifications from capturing via wildcards &lt;code&gt;cy.route('/api/posts/*')&lt;/code&gt; to specifying the protocol first like so: &lt;code&gt;cy.route('POST', '/api/posts/*', mockResponse)&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;You can even pass in a function to handle/generate a response or even assert on the request body.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cy.route&lt;/code&gt; is deprecated though so you can always jump into using &lt;code&gt;cy.intercept&lt;/code&gt;. The main reason I'm not using it is because last time I checked, &lt;code&gt;intercept&lt;/code&gt; had a bug where it didn't match wildcards (the &lt;code&gt;*&lt;/code&gt; in URLs). But &lt;code&gt;cy.intercept&lt;/code&gt; is super powerful. Go checkout &lt;a href="https://docs.cypress.io/api/commands/intercept.html" rel="noopener noreferrer"&gt;cy.intercept docs&lt;/a&gt; for more info. &lt;/p&gt;

&lt;p&gt;The point being, Cypress lets you run your &lt;em&gt;frontend&lt;/em&gt; without hitting your &lt;em&gt;backend&lt;/em&gt; if necessary.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>learning</category>
    </item>
    <item>
      <title>Demystifying the find command</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Mon, 07 Dec 2020 15:12:37 +0000</pubDate>
      <link>https://dev.to/antjanus/demystifying-the-find-command-1kcp</link>
      <guid>https://dev.to/antjanus/demystifying-the-find-command-1kcp</guid>
      <description>&lt;h2&gt;
  
  
  📃 Cheatsheet
&lt;/h2&gt;

&lt;p&gt;List all files and folders in current directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find files/folders that match a pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"*pattern*"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run a command per result. Substitute &lt;code&gt;command&lt;/code&gt; with your actual command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"*pattern*"&lt;/span&gt; &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="o"&gt;{}&lt;/span&gt; +&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What is find?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;find&lt;/code&gt; is a command I rarely come across but it turns out, it's one of the more powerful commands in Unix-like system. Find, at its basest, lists all the files and folders in a directory. Kind of like a recursive &lt;code&gt;ls&lt;/code&gt;. This can be piped into any command. But find also has other features like filtering and the ability to execute a command on each matching file.&lt;/p&gt;

&lt;p&gt;Find is also sometimes used as the "backend" for fuzzy file searchers. For example, &lt;code&gt;fzf&lt;/code&gt; uses &lt;code&gt;find&lt;/code&gt; under the hood to employ fuzzy search in the command line (which is super useful).&lt;/p&gt;

&lt;h2&gt;
  
  
  Plain "find"
&lt;/h2&gt;

&lt;p&gt;Using &lt;code&gt;find&lt;/code&gt; alone will print out all directories and files located under your current working directory. This is useful for piping or other actions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just for the sake of completeness, you can also specify a path but &lt;code&gt;find&lt;/code&gt; will assume you want to search your current directory by default.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find /path/to/dir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Find file or directory by pattern
&lt;/h2&gt;

&lt;p&gt;To find a file or directory, one can specify its name and pass it in as an argument. Both files or directories will match.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"package.json"&lt;/span&gt;
find &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"node_modules"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find will return &lt;em&gt;any&lt;/em&gt; matches including nested directories. Note that the match isn't done on the path but on the actual directory/file name itself.&lt;/p&gt;

&lt;p&gt;You can also specify a pattern using &lt;code&gt;*&lt;/code&gt; as a wildcard like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"pattern*"&lt;/span&gt;
find &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"*.spec.js"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Execute a command on all found files
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;find&lt;/code&gt; allows you to execute logic on every single match it finds via the &lt;code&gt;-exec&lt;/code&gt; flag. There are 2 ways to execute commands: once on all the results or run it per result.&lt;/p&gt;

&lt;p&gt;Here's once for all results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# substitute any kind of command for the keyword "command"&lt;/span&gt;
find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"*.js"&lt;/span&gt; &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="o"&gt;{}&lt;/span&gt; &lt;span class="se"&gt;\;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command has several parts. We're already familiar with the pattern matching so next comes the &lt;code&gt;-exec&lt;/code&gt; flag. After &lt;code&gt;exec&lt;/code&gt;, you can type out your command and end it with &lt;code&gt;\;&lt;/code&gt;. The &lt;code&gt;{}&lt;/code&gt; braces will be substituted with the &lt;code&gt;find&lt;/code&gt; results. &lt;/p&gt;

&lt;p&gt;To run the command separately &lt;em&gt;per&lt;/em&gt; result, end your command with &lt;code&gt;+&lt;/code&gt; instead of &lt;code&gt;\;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# substitute any kind of command for the keyword "command"&lt;/span&gt;
find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"*.js"&lt;/span&gt; &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="o"&gt;{}&lt;/span&gt; +
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Other demystifying articles
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/antjanus/demystifying-grep-a1o"&gt;Demystifying GREP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/antjanus/demystifying-rsync-3jac"&gt;Demystifying Rsync&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/antjanus/demystifying-tar-351l"&gt;Demystifying TAR&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>linux</category>
      <category>tools</category>
      <category>productivity</category>
      <category>shell</category>
    </item>
    <item>
      <title>Using Postgres FOR loop to generate data</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Fri, 26 Jun 2020 22:08:09 +0000</pubDate>
      <link>https://dev.to/antjanus/using-postgres-for-loop-to-generate-data-3mm2</link>
      <guid>https://dev.to/antjanus/using-postgres-for-loop-to-generate-data-3mm2</guid>
      <description>&lt;p&gt;I don't know about you but I often need a 100 of &lt;em&gt;something&lt;/em&gt; in my database to properly test a page. If my UI isn't developed yet to handle that action or the count of &lt;em&gt;something&lt;/em&gt; is too large, that's when I turn to SQL. &lt;/p&gt;

&lt;p&gt;Today, for instance, I needed to test virtual scrolling and I didn't have enough data locally to trigger that behavior so I wrote a quick loop in Postgres to generate a 100 items:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;DO&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;FN&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
  &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="n"&gt;counter&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="n"&gt;LOOP&lt;/span&gt;
    &lt;span class="n"&gt;RAISE&lt;/span&gt; &lt;span class="n"&gt;NOTICE&lt;/span&gt; &lt;span class="s1"&gt;'Counter: %'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;EXECUTE&lt;/span&gt; &lt;span class="err"&gt;$$&lt;/span&gt; &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Test item '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;RETURNING&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="err"&gt;$$&lt;/span&gt; 
      &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="n"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;END&lt;/span&gt; &lt;span class="n"&gt;LOOP&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="n"&gt;FN&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you've followed me for a while, you'll recognize this loop from &lt;a href="https://dev.to/antjanus/the-wild-sql-loop-i-had-to-write-for-work-this-week-24n2"&gt;the wild SQL query&lt;/a&gt; I had to write for work. However, this loops is much simpler. And this item would generate 100 items in my database with sequentially numbered names.&lt;/p&gt;

&lt;p&gt;Let's go through this query real quick&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;DO&lt;/code&gt; block
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;DO&lt;/code&gt; block creates a special block that can execute some SQL. It's start and end is denoted by &lt;code&gt;$FN$&lt;/code&gt; in my query but you can use any delimiter that starts and ends with a dollar sign. So &lt;code&gt;$DO$&lt;/code&gt; works, as does &lt;code&gt;$MY_FUNKY_LOOP$&lt;/code&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;BEGIN...END&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;BEGIN&lt;/code&gt; and &lt;code&gt;END&lt;/code&gt; create the section of the loop which runs the actual SQL statement. You can also have a &lt;code&gt;DECLARE&lt;/code&gt; section which lets us assign and create some variables. We don't need it here.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;FOR LOOP&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;FOR counter IN 1..100 LOOP&lt;/code&gt; lets us create a for loop. Postgres has a handy way of creating ranges via the &lt;code&gt;..&lt;/code&gt; syntax (so &lt;code&gt;1..100&lt;/code&gt; is 1 through 100). The current value of the range in the iteration is saved in the &lt;code&gt;counter&lt;/code&gt; variable.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;RAISE NOTICE&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;This is the &lt;code&gt;console.log&lt;/code&gt; of Postgres :)&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;EXECUTE $$ $$ USING&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;EXECUTE&lt;/code&gt; will literally just execute the SQL between &lt;code&gt;$$&lt;/code&gt;. What EXECUTE lets us do is specify &lt;code&gt;USING&lt;/code&gt; which is used for variable substitution.&lt;/p&gt;

&lt;p&gt;I like to think of this as a little self-executing function where &lt;code&gt;USING&lt;/code&gt; lets us specify the parameters and execute runs the SQL and substitutes our parameter in the statement.&lt;/p&gt;

&lt;p&gt;So as &lt;code&gt;counter&lt;/code&gt; increases, the item name will increment as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why even use this?
&lt;/h2&gt;

&lt;p&gt;It's just a super handy small snippet for generating data. 🤷&lt;/p&gt;

&lt;p&gt;What's cool is that the more I learn SQL, the more I find myself using these types of loops and logic and adding onto them. There's nothing stopping us from using some sort of random generator to create better varied data for development or for generating data in a staging environment.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>postgres</category>
      <category>productivity</category>
      <category>database</category>
    </item>
    <item>
      <title>What are your favorite themes for your IDE/Shell?</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Tue, 05 May 2020 17:33:52 +0000</pubDate>
      <link>https://dev.to/antjanus/what-are-your-favorite-themes-for-your-ide-shell-2c5d</link>
      <guid>https://dev.to/antjanus/what-are-your-favorite-themes-for-your-ide-shell-2c5d</guid>
      <description>&lt;p&gt;I'm on the hunt for a new VIM/VSCode/ZSH theme, I'd love to hear what your favorite ones are! (Mine will be in the comments)&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>productivity</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Demystifying GREP</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Thu, 09 Apr 2020 23:16:43 +0000</pubDate>
      <link>https://dev.to/antjanus/demystifying-grep-a1o</link>
      <guid>https://dev.to/antjanus/demystifying-grep-a1o</guid>
      <description>&lt;h2&gt;
  
  
  📃 Cheatsheet
&lt;/h2&gt;

&lt;p&gt;Search for a keyword in a file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep &lt;/span&gt;keyword file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Search using a regular expression:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s1"&gt;'regex'&lt;/span&gt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Search for a keyword in a directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; keyword ./directory/path
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Combine multiple flags/options to search through a directory, display line numbers, and use regex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-Enr&lt;/span&gt; &lt;span class="s1"&gt;'regex'&lt;/span&gt; ./directory/path
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔎 What is grep?
&lt;/h2&gt;

&lt;p&gt;Grep is a CLI utility for plain text searches with regex (regular expressions). It's like a Ctrl/Command + F but through a bunch of files and in the command line.&lt;/p&gt;

&lt;p&gt;It's another one of those ancient utilities that have proliferated through all Linux and Unixy distributions. Similar to &lt;a href="https://dev.to/antjanus/demystifying-rsync-3jac"&gt;Rsync&lt;/a&gt; and &lt;a href="https://dev.to/antjanus/demystifying-tar-351l"&gt;tar&lt;/a&gt; that I've talked about in the past.&lt;/p&gt;

&lt;p&gt;Fortunately, unlike rsync or tar, grep requires a lot less flags and knowledge of the tool to be very productive with it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Are you on Windows? Check out my &lt;a href="https://antjanus.com/blog/web-development-tutorials/how-to-grep-in-powershell/" rel="noopener noreferrer"&gt;article on "how to 'grep' in Powershell"&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  📄 Searching for a keyword in a file
&lt;/h2&gt;

&lt;p&gt;If you're in the command line and you don't necessarily want to open a file, or you're dealing with an enormous file, it can be very handy to look for just one line of text using grep.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep &lt;/span&gt;searchkeyword file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Grep will return all the lines containing the text. Depending on your grep variant, you might get line numbers, the keyword highlighted, and other fun information.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔬 Searching using regular expressions with the &lt;code&gt;-E&lt;/code&gt; flag
&lt;/h2&gt;

&lt;p&gt;Need to use a regular expression because you're a pro at those? Wrapping a regex in quotes will do it most of the time; however, some syntax isn't supported this way so you have to use the &lt;code&gt;-E&lt;/code&gt; flag. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s1"&gt;'^2020-0[0-4]'&lt;/span&gt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will work just fine, the &lt;code&gt;[]&lt;/code&gt; syntax is supported in basic regex mode; however, specifying occurrences with &lt;code&gt;{}&lt;/code&gt; won't work so I recommend defaulting to the &lt;code&gt;-E&lt;/code&gt; flag for any regex so you can do neat stuff like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s1"&gt;'[0-9]{4}-[0-9]{2}-[0-9]{2}'&lt;/span&gt; logfile.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This regex will fail in basic mode but the extended mode will match any &lt;code&gt;yyyy-mm-dd&lt;/code&gt; date anywhere within your text. &lt;/p&gt;

&lt;h2&gt;
  
  
  📂 Searching through multiple files/directory
&lt;/h2&gt;

&lt;p&gt;Grep lets you also recursively search through many files and directories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; searchkeyword directoryName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Grep will return all of the matching lines &lt;em&gt;and&lt;/em&gt; tell you in which files they were. &lt;/p&gt;

&lt;h2&gt;
  
  
  🏁 More flags
&lt;/h2&gt;

&lt;p&gt;Grep has a great deal of options. Their manual page is &lt;em&gt;very&lt;/em&gt; long and I suggest giving it a look when you feel like grep's basic capabilities just aren't enough for you.&lt;/p&gt;

&lt;p&gt;Here's the syntax to add or combine flags when using grep:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-flags&lt;/span&gt; searchkeyword directoryOrFilename
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-ir&lt;/span&gt; antonin ./documents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example, &lt;code&gt;-ir&lt;/code&gt; combines both the &lt;code&gt;i&lt;/code&gt; and the &lt;code&gt;r&lt;/code&gt; flag. Similarly, &lt;code&gt;-Er&lt;/code&gt; would let us recursively search with extended regex.&lt;/p&gt;

&lt;p&gt;Quick run down of some of these useful flags:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;i&lt;/code&gt; - case insensitive flag&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;n&lt;/code&gt; - show line numbers in the matches&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;o&lt;/code&gt; - print only the matches, and not the lines (particularly useful with regex)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>linux</category>
      <category>shell</category>
      <category>productivity</category>
    </item>
    <item>
      <title>What are your top WFH/Remote working tips?</title>
      <dc:creator>Ant The Developer</dc:creator>
      <pubDate>Wed, 11 Mar 2020 16:32:37 +0000</pubDate>
      <link>https://dev.to/antjanus/what-are-your-top-wfh-remote-working-tips-2nfi</link>
      <guid>https://dev.to/antjanus/what-are-your-top-wfh-remote-working-tips-2nfi</guid>
      <description>&lt;p&gt;So many people are having to work from home or work remotely due to COVID-19, what are your tips for them?&lt;/p&gt;

&lt;p&gt;Here are mine:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get dressed -- doesn't have to be formal, just avoid pajamas or bathrobes&lt;/li&gt;
&lt;li&gt;set a regular schedule as you would in office -- even if it's an unconventional schedule&lt;/li&gt;
&lt;li&gt;work in a space separate from your relax/wind down place -- working on a couch has always been a productivity killer&lt;/li&gt;
&lt;li&gt;take breaks to make coffee&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>discuss</category>
      <category>remote</category>
      <category>wfh</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
