Component Driven Development

1. What is Component Driven Development?

What is CDD?

  • Can proceed with development by making UI components in parts

  • Development method closer to bottom-up development that builds pages by assembling components in component units

CSS in JS

  • Various attempts for CSS structuring

    • Used SASS, a scripting language that extends CSS, as preprocessor, but compiled CSS size became large

  • To supplement SASS problems, various CSS methodologies with the following orientations emerged:

    • Code reusability

    • Code simplification (easy maintenance)

    • Code extensibility

    • Code predictability (through class names, etc.)

    • Styled-Component: Provides very simple pattern that can completely separate UI from components with state

2. CDD Development Tools

Styled Components

Library that componentizes CSS, usable in React environment, can put CSS inside JavaScript

Installing Styled Components

Import to file that will use Styled Components

Making Components

Making new component by reusing component

Using Props

Rendering with Props value

3. useRef

useRef that can utilize DOM reference well

React can reference address values to DOM nodes, elements, React elements with useRef in exceptional situations

Can use useRef in limited situations below, but goes against React's characteristic and advantage of declarative programming principle, so except for those situations, overuse of useRef is inappropriate

Last updated