技術記事以外

技術記事以外の振り返りやその日学んだことのちょっとしたメモなどを置く予定です

今日の学習メモ

MySQL

  • Relay log is created only in slave when replication is configured. I/O thread receives binary log from master and put it into relay log file. Then, SQL thread picks update info from the logs, apply for DB and delete that log. When there is a rotate event, sequence number added to file name is incremented. The rotate events happens when I/O thread is started up (=when slave start) or log is flushed and so on.

  • Flush log means close current long file and create new file with next sequence no.

React Hooks

  • Sometimes arrow function set in onClick cause performance issue, in that casem useCallback might work.

  • You can set arrow function in the useState like useState (() -> calcFnI()). By doing so, it is only calculated in initial rendering. Usually, it is calculated every time rendering occurs. (Not common)

  • If the state is updated with the same value, child component will not be re-evaluated.

  • There are two types of side effects. One does not require clean up. It will be executed after each rendering. The other one is doing clean up before executing side effect. (maybe doing unsubscribe?)

  • Also, as the second arg, you can specify based on what peops update you'll execute the side effect.

  • Usecontext allow you to take global state and can avoid bucket relay. When context is updated, the only component using context is updated.

  • If use named function instead of arrow, maybe the only advantage is to name is appeared on stacktrace