Why Everybody Needs a Framework

Rate this content
Bookmark

The prevalent advice on how to use React today is to use a framework: either to start with one or to incrementally adopt one. This deep-dive talk will explore why, and how to go about this with live code examples.

FAQ

The main focus of Tejas's talk is on the importance of using frameworks in development, particularly emphasizing the benefits of using React and React frameworks like Next.js or ReMix.

According to Tejas, a framework is essentially a set of opinions that provides a structure within which developers work. It guides on aspects like routing, data fetching, and where rendering should occur, helping to accelerate development workflows by handling these concerns.

Frameworks solve several key problems including server-side rendering, client and server-side routing, and simplifying data fetching. They prevent issues like network waterfalls by managing data fetching efficiently, which enhances performance and user experience.

Tejas argues that frameworks provide a structured approach to building applications, handling routine challenges and intricacies that can bog down development if handled individually. Frameworks like React and its associated tools ensure that developers can focus on building out features rather than solving common problems repeatedly.

In his live demo, Tejas demonstrated a full-stack application using a jokes app. The demo included both frontend and backend aspects, showcasing how frameworks can manage data fetching and server-side rendering effectively.

Tejas Kumar
Tejas Kumar
39 min
20 Oct, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Today's Talk explores the value of using frameworks in software development, specifically focusing on React and its impact on web development. The Talk delves into the benefits of frameworks, such as solving routing and data fetching challenges, handling edge cases, and providing server-side rendering. It also introduces the concept of server components and their role in server-side rendering. The Talk highlights the advantages of soft navigation and the seamless communication between client and server. Overall, frameworks offer valuable functionality that enhances productivity and addresses common development challenges.

1. Introduction to Frameworks

Short description:

Today we're here to talk about why everybody needs to use a framework. React has revolutionized the way we build on the web. Andrew Clark from the React team on Vercel posted that if you use React, you should be using a React framework. A framework is essentially a set of opinions that help you accelerate your development workflows.

Hi! How are we? OK, I'll work with it. It's the last talk of the day. You know, fun fact, I have 25 minutes. It's on 16 minutes. I have 20 minutes, right? But it's the last talk, so technically, I have all the minutes. Cause the after-party from here is at 7. But anyway, I'll try and be respectful of your time. The organizer is looking at me here like, hey, hey, now.

I'm Tejas. That's pronounced, like, contagious. I can say that now cause the lockdowns, for the most part, are over. And I've had the privilege of working in some capacity, either as a consultant or as an employee at a number of different tech companies across my career. And it's an opportunity that I'm really thankful for. And through it, I get to experience a bunch of different things, right? Today, I run a small but effective developer relations agency where we support developer tools, developer-oriented companies, communicate, get their message across, and really refine that developer experience, okay? But that's not what we're here to talk about today. Today we're here to talk about why everybody needs to use a framework. And you might be reading this and going, what does that even mean? Does everybody need to use a framework? Ideally, we clarify some of those things today. I just need to preface. I'm not... I don't work on React. I've been working with React since 2013, 2014, and I deeply love it. I have the privilege of knowing some of the team. And the work they do is inspiring and is intellectual and solves real world problems with high abstractions that just get the job done and make you, guys, the hero. So if we can hear it for the team. I would really... Yeah. Yeah. It has... I think it's an understatement to say that React has revolutionized the way we build on the web. And I think it's worth acknowledging.

So why does everybody need to use a framework? Where does this even come from? Earlier on X, the platform formerly known as Twitter, Andrew Clark from the React team on Vercel posted this in January. He said, if you use React, you should be using a React framework. If your existing app doesn't use a framework, you should incrementally migrate to one. If you're creating a new React project, you should use a framework from the beginning. Some of you might be thinking, but isn't React a framework? Is React a library or framework? We're not doing that today. Let's go on social media and fight. No. But React by framework, what Andrew is referring to is something like Next.js or ReMix, et cetera. And I love this. I use framework. Are any of you using frameworks here in production? Okay, almost everybody. For those of you not, let's talk about why. And this is what I want to do today. This is great, but I want to understand the mechanism that leads us to arrive at that conclusion. Like, why does one say this? And to understand the mechanism, you have to answer the question, okay, what even is a framework? And a framework is essentially a set of opinions. It's a frame within which you work, literally. It gives you opinions around routing, around data fetching, around where do you render the server or the client somewhere in between. And these opinions are handled for you so that you can, you can what? You can build your product with velocity. You don't have to solve these problems individually. So it's the opinions that help you accelerate your development workflows, okay? If we refine that a little bit, what do frameworks do? What do frameworks do? Well, a lot of them have overlap. This is maybe not every framework, but Next JS, Remix.

2. Frameworks and Demo

Short description:

They solve routing on both the client and server side. Frameworks make data fetching easier and more efficient. They also handle edge cases that we may overlook. Let's dive into a demo that showcases server-side rendering and data fetching. We'll explore a full stack application and fill a database interactively. The app is a jokes app that queries a database and renders jokes on both the client and server side. We'll walk through the code and play with the app.

They'll do server side rendering. How many of you server side rendering in production? Okay. Almost everybody who uses a framework, great. They solve routing but not just on the client side. On the server side as well. Isomorphic routing. And this is useful for a number of reasons because previously back when we were doing only client side stuff, we used to send 404's. I don't know if you all remember this. We used to send 404 status codes from the server side and then a 404 HTML page would pick up on the client side and give you an app. But this is fundamentally a lie from client to server, okay? And frameworks solve for that.

Number three, data fetching is tremendously easier with frameworks. If I ask you, where's the best place and when is the best time to fetch data in your React app? What would you tell me? Would you tell me that I use effect and I fetch inside use effect and then I set state? That's a really common pattern but that's a problematic pattern because it leads to what? It leads to, I see you, this is React Advanced. We're not in kindergarten here, right? It leads to network waterfalls. It leads to slow things. You've got to render first, that takes some time. It's CPU bound and then you've got to fetch and then you've got to render and it's not fast, it's not performant and your user experience suffers. So frameworks solve a lot of these problems for us and more. In fact, they solve all the edge cases that we probably miss because they're built by very large communities who run into problems that we may have next year today. OK.

So that's the theory of it but I'm already bored with my slides and I figure we just do a little demo for that. This is a demo that solves for those things. It solves for rendering on the server side, it solves for data fetching, etc. It's kind of interactive and it's the end of the day, let's just play. Since we're talking about server rendering and data fetching, we need a full stack application. We need a frontend, we need a backend. There's plenty of ready to go backends. If you need a quick API, there's dog.ceo where you can query a bunch of dogs. Since we're in London, I was on the search for a good backend. I happened to find a stealth London based start up that has been very quiet but has been building something really cool. I was so compelled, I had dinner with the founders last night. I was compelled let's just put it in my presentation and show you all this. I have permission for this but I want to just fill out the full stack of the stack. This is the application we have, so if we go to the browser, if we go to the code, OK. So it's a jokes app. It says no jokes. I don't know if you can read that, it's intentionally small but it's essentially going to query a database where jokes live and render them. Client side first, then server side and we'll do that together. But we need to fill this database somehow. Let me walk you through the code a little bit and then we'll fill it interactively. OK. It's the end of the day so let's play a bit. If we look at the code, what do we have? We have a React app here. Is that font size OK? Can you see in the back? Nobody cares? Great. OK. Let's... Boom! There we go. So, very basic React app. We're hydrating the document with a layout and if we have a joke ID, it's an answer, otherwise it's a question. It's a question answer type of joke, right? Like why did the chicken cross the road? Because there was hydration, I don't know. Whatever.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

A Guide to React Rendering Behavior
React Advanced Conference 2022React Advanced Conference 2022
25 min
A Guide to React Rendering Behavior
Top Content
React is a library for "rendering" UI from components, but many users find themselves confused about how React rendering actually works. What do terms like "rendering", "reconciliation", "Fibers", and "committing" actually mean? When do renders happen? How does Context affect rendering, and how do libraries like Redux cause updates? In this talk, we'll clear up the confusion and provide a solid foundation for understanding when, why, and how React renders. We'll look at: - What "rendering" actually is - How React queues renders and the standard rendering behavior - How keys and component types are used in rendering - Techniques for optimizing render performance - How context usage affects rendering behavior| - How external libraries tie into React rendering
Building Better Websites with Remix
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
Building Better Websites with Remix
Top Content
Remix is a new web framework from the creators of React Router that helps you build better, faster websites through a solid understanding of web fundamentals. Remix takes care of the heavy lifting like server rendering, code splitting, prefetching, and navigation and leaves you with the fun part: building something awesome!
Scaling Up with Remix and Micro Frontends
Remix Conf Europe 2022Remix Conf Europe 2022
23 min
Scaling Up with Remix and Micro Frontends
Top Content
Do you have a large product built by many teams? Are you struggling to release often? Did your frontend turn into a massive unmaintainable monolith? If, like me, you’ve answered yes to any of those questions, this talk is for you! I’ll show you exactly how you can build a micro frontend architecture with Remix to solve those challenges.
React Compiler - Understanding Idiomatic React (React Forget)
React Advanced Conference 2023React Advanced Conference 2023
33 min
React Compiler - Understanding Idiomatic React (React Forget)
Top Content
React provides a contract to developers- uphold certain rules, and React can efficiently and correctly update the UI. In this talk we'll explore these rules in depth, understanding the reasoning behind them and how they unlock new directions such as automatic memoization. 
Using useEffect Effectively
React Advanced Conference 2022React Advanced Conference 2022
30 min
Using useEffect Effectively
Top Content
Can useEffect affect your codebase negatively? From fetching data to fighting with imperative APIs, side effects are one of the biggest sources of frustration in web app development. And let’s be honest, putting everything in useEffect hooks doesn’t help much. In this talk, we'll demystify the useEffect hook and get a better understanding of when (and when not) to use it, as well as discover how declarative effects can make effect management more maintainable in even the most complex React apps.
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Too much JavaScript is getting you down? New frameworks promising no JavaScript look interesting, but you have an existing React application to maintain. What if Qwik React is your answer for faster applications startup and better user experience? Qwik React allows you to easily turn your React application into a collection of islands, which can be SSRed and delayed hydrated, and in some instances, hydration skipped altogether. And all of this in an incremental way without a rewrite.

Workshops on related topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Concurrent Rendering Adventures in React 18
React Advanced Conference 2021React Advanced Conference 2021
132 min
Concurrent Rendering Adventures in React 18
Top Content
Featured WorkshopFree
Maurice de Beijer
Maurice de Beijer
With the release of React 18 we finally get the long awaited concurrent rendering. But how is that going to affect your application? What are the benefits of concurrent rendering in React? What do you need to do to switch to concurrent rendering when you upgrade to React 18? And what if you don’t want or can’t use concurrent rendering yet?

There are some behavior changes you need to be aware of! In this workshop we will cover all of those subjects and more.

Join me with your laptop in this interactive workshop. You will see how easy it is to switch to concurrent rendering in your React application. You will learn all about concurrent rendering, SuspenseList, the startTransition API and more.
React Hooks Tips Only the Pros Know
React Summit Remote Edition 2021React Summit Remote Edition 2021
177 min
React Hooks Tips Only the Pros Know
Top Content
Featured Workshop
Maurice de Beijer
Maurice de Beijer
The addition of the hooks API to React was quite a major change. Before hooks most components had to be class based. Now, with hooks, these are often much simpler functional components. Hooks can be really simple to use. Almost deceptively simple. Because there are still plenty of ways you can mess up with hooks. And it often turns out there are many ways where you can improve your components a better understanding of how each React hook can be used.You will learn all about the pros and cons of the various hooks. You will learn when to use useState() versus useReducer(). We will look at using useContext() efficiently. You will see when to use useLayoutEffect() and when useEffect() is better.
React, TypeScript, and TDD
React Advanced Conference 2021React Advanced Conference 2021
174 min
React, TypeScript, and TDD
Top Content
Featured WorkshopFree
Paul Everitt
Paul Everitt
ReactJS is wildly popular and thus wildly supported. TypeScript is increasingly popular, and thus increasingly supported.

The two together? Not as much. Given that they both change quickly, it's hard to find accurate learning materials.

React+TypeScript, with JetBrains IDEs? That three-part combination is the topic of this series. We'll show a little about a lot. Meaning, the key steps to getting productive, in the IDE, for React projects using TypeScript. Along the way we'll show test-driven development and emphasize tips-and-tricks in the IDE.
Web3 Workshop - Building Your First Dapp
React Advanced Conference 2021React Advanced Conference 2021
145 min
Web3 Workshop - Building Your First Dapp
Top Content
Featured WorkshopFree
Nader Dabit
Nader Dabit
In this workshop, you'll learn how to build your first full stack dapp on the Ethereum blockchain, reading and writing data to the network, and connecting a front end application to the contract you've deployed. By the end of the workshop, you'll understand how to set up a full stack development environment, run a local node, and interact with any smart contract using React, HardHat, and Ethers.js.
Designing Effective Tests With React Testing Library
React Summit 2023React Summit 2023
151 min
Designing Effective Tests With React Testing Library
Top Content
Featured Workshop
Josh Justice
Josh Justice
React Testing Library is a great framework for React component tests because there are a lot of questions it answers for you, so you don’t need to worry about those questions. But that doesn’t mean testing is easy. There are still a lot of questions you have to figure out for yourself: How many component tests should you write vs end-to-end tests or lower-level unit tests? How can you test a certain line of code that is tricky to test? And what in the world are you supposed to do about that persistent act() warning?
In this three-hour workshop we’ll introduce React Testing Library along with a mental model for how to think about designing your component tests. This mental model will help you see how to test each bit of logic, whether or not to mock dependencies, and will help improve the design of your components. You’ll walk away with the tools, techniques, and principles you need to implement low-cost, high-value component tests.
Table of contents- The different kinds of React application tests, and where component tests fit in- A mental model for thinking about the inputs and outputs of the components you test- Options for selecting DOM elements to verify and interact with them- The value of mocks and why they shouldn’t be avoided- The challenges with asynchrony in RTL tests and how to handle them
Prerequisites- Familiarity with building applications with React- Basic experience writing automated tests with Jest or another unit testing framework- You do not need any experience with React Testing Library- Machine setup: Node LTS, Yarn