F
12

I was writing the same code over and over for a month before I saw the problem

I kept making little web pages for practice and I'd write out the same navigation bar HTML and CSS every single time. It took me about 20 minutes each go. Then I watched a YouTube video from a channel called 'Web Dev Simplified' and he just... made a file and put the code in it. He called it a 'partial' and reused it. My mind was blown. I spent a whole month doing manual copy-paste when I could have saved that code once. Has anyone else had a simple idea like that completely change how you work?
3 comments

Log in to join the discussion

Log In
3 Comments
the_rose
the_rose11d agoTop Commenter
Actually, those are usually called components, not partials.
2
laura_wilson
Oh man, "usually called components" just gave me flashbacks. My buddy spent his whole first week at a new job calling them partials because that's what his old team used. His new lead kept correcting him in every code review. He said it felt like learning a whole new language for the same exact thing. It really messed with his head for a bit. Does the naming difference actually change how you build the thing, or is it just team preference?
7
angelamurphy
Usually called components" depends on the framework. Rails uses partials for templates, while React and Vue call them components. The core idea is reusable pieces, but the naming ties to the specific tools.
2