Styling React Apps

styling with Vanilla CSS

advantages

  • CSS code is decoupled with JSX code
  • You write CSS code as you (maybe) know and (maybe) love it
  • CSS code can be written by another developer who needs only a minimal amount of access to your JSX code

disadvantages

  • You need to know CSS
  • CSS code is not scoped to components: CSS rules may clash across components (e.g., same CSS class name used in different components for different purposes)

Scoping styles with CSS Modules

advantages

  • CSS code is decoupled from JSX code
  • You write CSS code as you (maybe) know and (maybe) love it
  • CSS code can be written by another developer who needs only a minimal amount of access to your JSX code
  • CSS classes are scoped to the component(files) which import them: No CSS class name clashes

disadvantages

  • You need to know CSS
  • You may end up with many relatively small CSS files in your project

CSS-in-JS Styling with “styled-components”

advantages

  • Quick & easy to add
  • You continue “thinking in React” (configurable style functions)
  • Styles are scoped to components: No CSS rule clashes

disadvantages

  • You need to know CSS
  • No clear separation of React & CSS code
  • You end up with many relatively small “wrapper” components

Styling with Tailwind Css

advantages

  • You don’t need to know (a lot about) CSS
  • Rapid development
  • No style clashes between components since you don’t define any CSS rules
  • Highly configurable & extensible

disadvantages

  • Relatively long className values
  • Any style changes require editing JSX
  • You end up with many relatively small”wrapper” components OR lots of copy & pasting

普通的一天

工作

现在通勤时间变短了,但是工作强度感觉变大了,主要是技术栈的变更,需要学习很多以前没有接触的东西。

今天和同事看了整个项目架构及流程,太多东西需要消化,没有了咖啡的加持,不到下班时间就感觉有些困了。

也可能和最近缺乏锻炼有关,身体状态没那么好,体重也增加了不少。工作要加油,身体也要弄好哇!

锻炼

看了下记录,上次有比较大运动量都已经是9月10号了。

在这之前大半个月还每隔两三天锻炼一下,最近又荒废了。整个人都感觉没那么有精神,很容易困,尤其吃过饭之后。

今天晚饭后也是如此,因为饿吃的也有点多,感觉有点撑。刚好中秋节前后弄了个动感单车,就在家里刚好也没理由不去运动了。

一共骑了20多分钟,胳膊上都是汗,腿也感觉有点酸酸的,但是明显感觉精神好一些了。

继续加油吧!后面单车和其他运动方式都继续坚持下去,甚至后面可以考虑买一台划船机。

relearn React

缘由

又要找工作了,由于市场行情不好,Vue 相关的岗位都少了,发现有些是要求 React 技术栈。之前有用过一阵 React,但是最近两三年都没用了,现在捡起来重新系统学一下。

内容

  • React - The Complete Guide 2024 (incl. Next.js, Redux) by Maximilian Schwarzmüller
  • advanced react: deep dives investigations performance patterns and techniques

Hello World

终于把 hexo 部署到了 oracle VPS 上了