framer/motion
SWR
framer/motion | SWR | |
---|---|---|
43 | 244 | |
22,462 | 29,722 | |
1.8% | 1.0% | |
9.8 | 8.2 | |
8 days ago | 12 days ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
framer/motion
-
How AnimatePresence in framer-motion works
The two most popular choices now (circa Jan 2024) are React Transition Group, started in 2016, and Framer Motion, started in 2018. I'm not too familiar with the former, so this article solely dives into the workings of AnimatePresence from Framer Motion and how it's able to enable exit animations.
- How can I make page transition like this using NextJS + Framer Motion?
-
Smooth Scrolling with React & Framer Motion
Install Framer Motion with npm install framer-motion.
-
5 Not-So-Typical React Libraries for an Outstanding Project
GitHub: https://github.com/framer/motion
-
"react-next-tilt" and "react-flip-tilt" NPM Packages
At this point, I was already using a tilt component (react-parallax-tilt) in my portfolio, and after checking this page I had the general idea of how it should be done, a container with transform-style: preserve-3d, with two children, one tilt and the other an image, both having backface-visibility: hidden and the tilt being rotated to face backward at the start. For the animation, I decided to use framer-motion because I was already familiar with it and knew it had what was needed to get the job done (and I'm glad I did because later I needed to await the animation and it was easy with framer-motion).
-
Motion UI in React
Two of the most popular animation libraries for React include React Spring [26.1k+ GitHub stars] and Framer Motion [19.6k+ GitHub stars], but there are many to choose from. Arafat Islam has a great list of animation libraries here.
- Best Animation packages for React.js , every frontend developer should use it
-
Framer Motion tutorial: How to easily create React animations
Why should you consider using Framer Motion in your React project? Framer Motion is a fairly popular and actively maintained library, with 19k stars on GitHub, and plenty of resources to support it.
- 5 React Libraries to Level Up your Projects in 2023
-
Best Animation Libraries For React🎉
Framer Motion has over 18,000 GitHub stars and 2.2M weekly NPM downloads.
SWR
-
Think Twice Before Using setInterval() for API Polling – It Might Not Be Ideal
Data fetching is a very simple task until it becomes complicated. Therefore I recommend that you use powerful data fetching libraries like TanStack Query, SWR, RTK Query.
-
Best Next.js Libraries and Tools in 2024
Link: https://swr.vercel.app/
-
How to Automatically Consume RESTful APIs in Your Frontend
Now, it's time to consume our API. We'll use React for this tutorail, but feel free to use any other framework you prefer; the process remains the same. Additionally, we'll utilize SWR to fetch data from the API and TypeScript to ensure type safety.
-
A day in the life of a developer - Building a dashboard app with SQL, Node.js, Django and Next.js
'use client'; import FormPostUpdate from './components/FormPostUpdate/FormPostUpdate'; import FormDelete from '../app/components/FormDelete/FormDelete'; import { useFetch } from './hooks/useFetch'; import { useFetchSWR } from './hooks/useFetchSWR'; import Chart from './components/Chart/Chart'; export default function Home() { // Uncomment the code below and comment out the "useFetch" code if your want to use SWR for data fetching --> https://swr.vercel.app/docs/with-nextjs // const { data, error, isLoading } = useFetchSWR( // 'http://127.0.0.1:8000/api/anime/' // ); // Uses the Fetch API for data fetching const { data, error, isLoading } = useFetch( 'http://127.0.0.1:8000/api/anime/' ); if (error) return
An error has occurred.; if (isLoading) returnLoading...; console.log(data); return ( <>POST: Add Anime Form
UPDATE: Update Anime Form
Select an ID from the list. You can change the data for Anime ID, Name and Release.
DELETE: Delete Anime Form
GET: Anime Data List
{data.map((anime) => (-
{anime.anime_name}
- ID: {anime.id}
- Anime ID: {anime.anime_id}
- Anime Release Year: {anime.anime_release}
-
-
API Data Fetching in React / Next.js
There are libraries like SWR, RTK Query, and React Query that simplify the data fetching process on the client and take care of the state, error handling, caching, and re-fetching for you.
-
How to Fetch API Data in React
Then install the package SWR into your application with the following command:
-
45 NPM Packages to Solve 16 React Problems
SWR
-
TanStack Query(a.k.a. React Query) v5 announced
I would suggest taking a look at SWR [0]. I think it strikes a very nice balance between using fetch and something more heavy-handed like React Query.
[0] https://swr.vercel.app/
-
Mastering Data Fetching in React: A Comprehensive Guide to SWR
Check out the official documentation for SWR here
-
Angular vs. React vs. Vue.js: Comparing performance
SWR: A React Hooks library for remote data fetching. It supports features like caching, revalidation, error handling, prefetching, pagination, and support for SSG and SSR. Its bundle size is 10kb minified and 4.4kb gzipped
What are some alternatives?
react-spring - ✌️ A spring physics based React animation library
axios - Promise based HTTP client for the browser and node.js
react-gsap-enhancer - Use the full power of React and GSAP together
react-query - 🤖 Powerful asynchronous state management, server-state utilities and data fetching for TS/JS, React, Solid, Svelte and Vue. [Moved to: https://github.com/TanStack/query]
react-motion - A spring that solves your animation problems.
redux - A JS library for predictable global state management
three.js - JavaScript 3D Library.
zustand - 🐻 Bear necessities for state management in React
GreenSock-JS - GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
redux-toolkit - The official, opinionated, batteries-included toolset for efficient Redux development
react-beautiful-dnd - Beautiful and accessible drag and drop for lists with React
redux-saga - An alternative side effect model for Redux apps