29
loading...
This website collects cookies to deliver better user experience
I'll release the two remaining parts in the next days here on dev.to. If you want to read all of them right away you can visit the original post at profy.dev.
When I built my first projects I started with an idea. Let's say an Airbnb for pet owners (no joke, I really built this).
I thought about the features it should have. The user should be able to create and update their profile. And there should be a list view that shows all the available apartments. Ideally searchable.
Fair enough. Off I went into code-land. That's the fun part after all, right?
Soon another interesting feature would pop into my head. I'd lose focus and start working on it straight away. Leaving me with a bunch of half-baked code. Entangled as the infamous spaghetti.
The layout was another kind of problem. I'd obviously have a look at Airbnb and similar competitors to get design ideas. Then I'd start writing CSS.
I'd fiddle around with my styles. I would move elements pixel by pixel. I'd change some colors here and increase some text size there. Make it bold, make it italic.
Only to find out that it's actually harder than expected to make a website look good...
// don't use global classes like this
import './index.css';
const MyComponent = () => (
// this will become class="box" in the HTML
<div className="box" />
)
// but rather scoped classes with CSS Modules
import styles from './Box.module.css';
const MyComponent = () => (
// this will become something like class="Box—box-3MbgH"
<div className={styles.box} />
)
// or styled-components (even better imo)
import styled from 'styled-components';
const Box = styled.div`
background: red;
`
const MyComponent = () => (
// this will be similar to class="Box—box-3MbgH"
<Box />
)
useState
, useReducer
, or useContext
should be sufficient.map
, filter
, or reduce
.