frontend-tech

Month: 2019-03

2019-03-04

mofas 08:14:58
https://overreacted.io/how-are-function-components-different-from-classes/

overreacted.io

How Are Function Components Different from Classes?

They’re a whole different Pokémon.

mrorz 10:27:17
老實講我寫起來的感覺有點微妙,或許只是還沒習慣 ._.

`useCallback` 如果忘記列 dependency,會導致 callback 一直記著過去 function 的 closure,這應該就是 memory leak 了吧 orz
mrorz 10:29:32
我自己是覺得 hook 沒有很好讀。

這個 component 是一堆 checkbox,其中有些 checkbox 有 indeterminate state,所以有很多 handler。

我自己會覺得這種狀況底下好像寫成 class 會比較好讀。

https://github.com/answerfamily/ly/blob/master/src/components/LegislatorSections.js
jihchi 22:36:59
各有優缺點,哪個好用就用哪個。這兩者不是各自的替代品。

2019-03-05

mofas 11:17:42
PSA: The latest Chrome Canary has removed support for web components
mofas 11:17:54
web components lose~~~~~
mrorz 11:18:11
wow

2019-03-07

2019-03-08

mofas 03:58:06
https://nginxconfig.io/

nginxconfig.io

nginxconfig.io

NGiИX configuration generator: HTTPS, HTTP2, CDN, PHP, HHVM, Frontend, Reverse proxy, Node.js, WordPress, Drupal, Magento, Python, Django, security headers, rate limiting, expiration by file types…

2019-03-09

lunkai 08:02:38
@kaikaikai1219 has joined the channel

2019-03-11

jihchi 13:41:34
https://overreacted.io/a-complete-guide-to-useeffect/

overreacted.io

A Complete Guide to useEffect

Effects are a part of your data flow.

2019-03-12

mrorz 17:20:27
https://blog.callstack.io/how-is-linaria-different-from-emotion-42e420a3984f
https://github.com/callstack/linaria/blob/master/docs/BENEFITS.md
我覺得 Linaria 做得到跟 emotion 差不多的事情(API 根本照抄ㄏㄏ),但又 zero runtime 這點滿猛的

唯一問題大概就是不能跟 CRA 一起用:
https://github.com/callstack/linaria/issues/308#issuecomment-462164541

但如果沒在用 CRA 的話感覺好像可以試試看

Callstack Engineers

How is Linaria different from Emotion and Styled Components

Recently we released our CSS in JS library - Linaria, which does build time evaluation and extraction of CSS to static files. We’ve been…

2019-03-16

jihchi 10:16:37
https://github.com/facebook/create-react-app/issues/6475

GitHub

Roadmap for version 3.0 · Issue #6475 · facebook/create-react-app

We are planning to release Create React App version 3.0 soon. This will be a relatively small release but will include a number of necessary breaking changes. Planned Features Jest 24: #6278 Hooks ...

2019-03-18

mofas 01:39:58
A new tool is coming!
mofas 07:07:50
https://overreacted.io/writing-resilient-components/

overreacted.io

Writing Resilient Components

Four principles to set you on the right path.

mrorz 11:44:16
overreacted 每一篇都好重要,但好長 orz

2019-03-19

mofas 11:03:59
"In the JavaScript community, there are a few strict opinionated style guides enforced by a linter. My personal observation is that they tend to create more friction than they’re worth. I can’t count how many times somebody showed me some absolutely valid code and said “React complains about this”, but it was their lint config complaining! This leads to three issues:"
mofas 11:04:19
That is why I don't like to use lint tool too much.
mrorz 11:13:46
現在我們都 prettier 說的算,eslint 只裝檢查 import / unused variable 的,不裝 airbnb
https://github.com/answerfamily/answerfamily-web/blob/master/.eslintrc.js

GitHub

answerfamily/answerfamily-web

我愛家我解惑網站. Contribute to answerfamily/answerfamily-web development by creating an account on GitHub.

jihchi 18:42:20
有些不是 coding style 還蠻好用,像是 unused variable 之類