SSR、CSR 與 React
看到一篇不錯的文章,詳細的介紹了 ssr、csr 的不同與優缺點,還附上了 demo 與 example code
Server-Side Rendering with React, Redux, and React-Router
各別優缺點
CSR (Client-Side Rendering)
PROS
- Rich site interactions
- Fast rendering after the initial load
- Partial real-time updates
- Cheaper to host & scale
CONS
- SEO and index issues
- Mostly initial bundle.js load duration
- Performance issues on old mobile devices/slow networks
- Social Media crawlers and sharing problems (SMO)
SSR (Server Side Rendering)
PROS
- Consistent SEO
- Performance, initial page load
- Works well with Social Media crawlers and platforms (SMO)
CONS
- Frequent requests
- Slow page rendering (TTFB — Time to first byte)
- Complex architecture (For universal approach)