Home / Companies / Clerk / Blog / May 2022

May 2022 Summaries

2 posts from Clerk

Filter
Month: Year:
Post Summaries Back to Blog
The text highlights key considerations and strategies for designing React hooks for API access, emphasizing the importance of not using secret keys in the browser and instead utilizing session tokens or JWTs for user-based access. It suggests transforming GET methods into hooks to simplify asynchronous operations in React components, thus avoiding the verbosity and complexity of using Promises with useEffect and useState. The discussion extends to handling mutations with hooks, introducing two strategies: eager refresh, which is more performant but challenging to configure, and sequential refresh, which is less efficient but more straightforward, particularly when dealing with side effects. The goal is to ensure hooks automatically react to changes, aligning with React's principles, and to choose the appropriate refresh strategy based on performance needs and configuration complexity.
May 20, 2022 716 words in the original blog post.
Server-Side Rendering (SSR) for React involves running React on the server to generate a page's initial HTML, which is then enhanced on the client side for interactivity. This process is beneficial for search engine indexing and reducing application complexity, particularly when using frameworks like Next.js that simplify SSR setup. The text provides detailed instructions on implementing SSR with Next.js, including fetching data with `getServerSideProps` and using Clerk for authentication. Clerk's integration with SSR allows for user authentication and data retrieval, such as user IDs or JWT tokens, before rendering a page. Additionally, it enables full SSR mode, which allows retrieval of the complete user object, offering functionalities like accessing a user's primary email address. The text encourages developers to explore further resources for integrating authentication quickly through Clerk's Next.js support and offers community support via platforms like Discord and Twitter.
May 07, 2022 1,039 words in the original blog post.