Why not write logic in Astro layouts
I wrote in Astro page layout and middleware execution order how I moved some logic to a layout.
Had to roll back because turns out I couldn’t run Astro.redirect()
in a layout, since Astro tells me the response has already been sent to the client.
Turns out this was something I absolutely needed, so moved back to handling the logic in the pages, which was ultimately the right thing from the start.
Discovering new things each and every day.
→ I wrote 17 books to help you become a better developer:
- C Handbook
- Command Line Handbook
- CSS Handbook
- Express Handbook
- Git Cheat Sheet
- Go Handbook
- HTML Handbook
- JS Handbook
- Laravel Handbook
- Next.js Handbook
- Node.js Handbook
- PHP Handbook
- Python Handbook
- React Handbook
- SQL Handbook
- Svelte Handbook
- Swift Handbook
Also, JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025