react-bits
An open source collection of animated, interactive & fully customizable React components for building memorable websites.
Top Related Projects
Cheatsheets for experienced React developers getting started with TypeScript
The React documentation website
A collection of awesome things regarding React ecosystem
Curated List of React Components & Libraries.
JavaScript Style Guide
Quick Overview
React-bits is a collection of React patterns, techniques, tips, and tricks. It serves as a comprehensive resource for React developers, offering insights into best practices, performance optimizations, and common pitfalls to avoid when working with React.
Pros
- Extensive coverage of React concepts and patterns
- Well-organized and easy to navigate
- Regularly updated with new content
- Includes practical examples and explanations
Cons
- May be overwhelming for beginners due to the large amount of information
- Some advanced topics might require additional background knowledge
- Not a structured tutorial or course, which might not suit all learning styles
- Some examples may become outdated as React evolves
Code Examples
Here are a few code examples from the React-bits repository:
- Conditional Rendering:
const MyComponent = ({ isLoggedIn }) => (
<div>
{isLoggedIn ? (
<LogoutButton />
) : (
<LoginButton />
)}
</div>
);
This example demonstrates how to conditionally render components based on a prop.
- Higher-Order Components (HOC):
const withLoading = (WrappedComponent) => {
return class extends React.Component {
state = {
isLoading: true,
};
componentDidMount() {
// Simulate API call
setTimeout(() => {
this.setState({ isLoading: false });
}, 2000);
}
render() {
return this.state.isLoading ? (
<LoadingSpinner />
) : (
<WrappedComponent {...this.props} />
);
}
};
};
This HOC adds loading functionality to any component it wraps.
- Using React Hooks:
import React, { useState, useEffect } from 'react';
const DataFetcher = () => {
const [data, setData] = useState(null);
useEffect(() => {
fetchData().then(result => setData(result));
}, []);
return (
<div>
{data ? <DisplayData data={data} /> : <LoadingSpinner />}
</div>
);
};
This example shows how to use the useState and useEffect hooks to manage state and side effects in a functional component.
Getting Started
To start using React-bits:
- Visit the GitHub repository: https://github.com/DavidHDev/react-bits
- Browse through the table of contents to find topics of interest
- Read the explanations and study the code examples provided
- Try implementing the patterns and techniques in your own React projects
- Refer back to the repository when you encounter specific React-related challenges or need inspiration for best practices
Competitor Comparisons
Cheatsheets for experienced React developers getting started with TypeScript
Pros of react
- Focuses specifically on TypeScript with React, providing in-depth TypeScript-related guidance
- Regularly updated with contributions from a large community
- Includes cheatsheets for various React-related topics like hooks, component patterns, and testing
Cons of react
- Less coverage of general React best practices and patterns
- May be overwhelming for beginners due to its focus on TypeScript complexities
- Lacks detailed explanations for some advanced concepts
Code Comparison
react-bits:
const PureComponent = (props) => {
return <div>{props.text}</div>;
};
react:
interface Props {
text: string;
}
const PureComponent: React.FC<Props> = ({ text }) => {
return <div>{text}</div>;
};
The react repository provides TypeScript-specific implementations, including type definitions for props, while react-bits focuses on JavaScript examples. The react code snippet demonstrates how to define prop types using TypeScript interfaces, which can help catch errors during development and improve code maintainability.
The React documentation website
Pros of react.dev
- Official React documentation repository, ensuring up-to-date and accurate information
- Comprehensive coverage of React concepts, including advanced topics and best practices
- Regularly maintained and updated by the React core team and community contributors
Cons of react.dev
- Larger and more complex repository structure, potentially overwhelming for beginners
- Focuses primarily on documentation rather than practical code snippets and examples
- May require more time to navigate and find specific information
Code Comparison
react.dev:
function MyButton() {
return (
<button>I'm a button</button>
);
}
export default function MyApp() {
return (
<div>
<h1>Welcome to my app</h1>
<MyButton />
</div>
);
}
react-bits:
const PureComponent = (props) => {
return (
<div>
{props.name}
</div>
);
};
export default PureComponent;
The react.dev example demonstrates a more complete React application structure, including a custom component and its usage. The react-bits example focuses on a specific concept (Pure Components) with a simpler implementation.
A collection of awesome things regarding React ecosystem
Pros of awesome-react
- More comprehensive coverage of React ecosystem
- Regularly updated with new resources and tools
- Well-organized into clear categories for easy navigation
Cons of awesome-react
- Less focused on specific React patterns and techniques
- May be overwhelming for beginners due to the sheer volume of information
- Lacks detailed explanations for each resource
Code comparison
react-bits focuses on specific React patterns and techniques, often providing code examples:
// Higher Order Component (HOC) example
const withData = WrappedComponent => {
return class extends React.Component {
render() {
return <WrappedComponent data={this.state.data} {...this.props} />;
}
}
}
awesome-react primarily provides links to resources rather than code examples. However, it may include snippets in some sections:
// Example from a linked resource
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
react-bits offers more in-depth code examples and explanations for specific React patterns, while awesome-react serves as a comprehensive directory of React-related resources, tools, and libraries. The choice between the two depends on whether you're looking for specific React techniques or a broader overview of the React ecosystem.
Curated List of React Components & Libraries.
Pros of awesome-react-components
- Extensive collection of React components, libraries, and tools
- Well-organized categories for easy navigation
- Regularly updated with new components and resources
Cons of awesome-react-components
- Lacks in-depth explanations or code snippets for each component
- May overwhelm beginners with the sheer number of options
- Doesn't provide best practices or patterns for React development
Code comparison
react-bits focuses on React patterns and best practices, while awesome-react-components is a curated list of components. Therefore, a direct code comparison isn't applicable. However, here's an example of how they differ in content:
react-bits example (Conditional Rendering):
{condition && <span>Rendered when condition is true</span>}
awesome-react-components example (Component listing):
- [react-burger-menu](https://github.com/negomi/react-burger-menu) - An off-canvas sidebar component with effects.
Summary
react-bits is more suitable for developers looking to improve their React skills and learn best practices, while awesome-react-components serves as a comprehensive directory of ready-to-use components and libraries. The choice between the two depends on whether you're seeking to enhance your React knowledge or find specific components for your project.
JavaScript Style Guide
Pros of javascript
- Comprehensive JavaScript style guide covering a wide range of topics
- Well-maintained with regular updates and contributions from the community
- Includes ESLint configuration for easy implementation
Cons of javascript
- Focuses primarily on JavaScript, with limited React-specific guidance
- May be overwhelming for beginners due to its extensive coverage
Code Comparison
javascript:
// bad
const items = new Array();
// good
const items = [];
react-bits:
// bad
const { users, isLoading } = this.state;
return (
<div>
{isLoading ? <LoadingSpinner /> : <UserList users={users} />}
</div>
);
// good
const { users, isLoading } = this.state;
if (isLoading) {
return <LoadingSpinner />;
}
return <UserList users={users} />;
Summary
javascript is a comprehensive JavaScript style guide maintained by Airbnb, offering extensive coverage of JavaScript best practices and ESLint configuration. react-bits, on the other hand, focuses specifically on React patterns and anti-patterns, providing more targeted guidance for React developers.
While javascript is more comprehensive and regularly updated, it may be overwhelming for beginners and lacks React-specific content. react-bits fills this gap by offering React-centric advice but may not cover broader JavaScript topics as thoroughly.
The code examples demonstrate the different focus areas: javascript emphasizes general JavaScript practices, while react-bits showcases React-specific patterns for improved readability and maintainability.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
The largest & most creative library of animated React components.
Stand out with 110+ free, customizable animations for text, backgrounds, and UI.
ð Documentation · â¡ Quick Start · ð ï¸ Tools
⨠Why React Bits?
React Bits helps you ship stunning interfaces faster. Instead of spending hours crafting animations from scratch, grab a polished component and customize it to fit your vision.
ð¬ Text Animations · ð Animations · ð§© Components · ð¼ï¸ Backgrounds
ð Features
- 110+ components â text animations, UI elements, and backgrounds, growing weekly
- Minimal dependencies â lightweight and tree-shakeable
- Fully customizable â tweak everything via props or edit the source directly
- 4 variants per component â JS-CSS, JS-TW, TS-CSS, TS-TW (everyone's happy)
- Copy-paste ready â works with any modern React project
ð ï¸ Creative Tools
Beyond components, React Bits offers free creative tools to supercharge your workflow:
| Tool | What it does |
|---|---|
| Background Studio | Explore animated backgrounds, customize effects, export as video/image/code |
| Shape Magic | Create inner rounded corners between shapes, export as SVG, React code or clip-path code |
| Texture Lab | Apply 20+ effects (noise, dithering, ASCII) to images/videos and export in high quality |
ð¦ Installation
React Bits supports shadcn and jsrepo for quick CLI installs.
# Example: Add a component via shadcn
npx shadcn@latest add @react-bits/BlurText-TS-TW
Each component page includes copy-ready CLI commands. See the installation guide for full details.
You can also select your preferred technologies, and copy the code manually.
ð Sponsors
React Bits is proudly supported by these amazing sponsors:
Diamond
Silver
Become a sponsor â Get your brand in front of 500K+ developers monthly.
ð¤ Contributing
We'd love your help! Check the open issues or submit ideas via the feature request template.
Please read the contribution guide first â thanks for making React Bits better!
ð Contributors
ð¤ Maintainer
David Haz â creator & lead maintainer
ð Official Ports
| Framework | Link |
|---|---|
| Vue.js | vue-bits.dev |
ð Stats
ð³ï¸ Credit
React Bits occasionally draws inspiration from publicly available code examples. These are rewritten as full-fledged, customizable components for JS, TS, CSS, and Tailwind. If you recognize your work, open an issue to request credit.
ð License
MIT + Commons Clause â free for personal and commercial use.
Top Related Projects
Cheatsheets for experienced React developers getting started with TypeScript
The React documentation website
A collection of awesome things regarding React ecosystem
Curated List of React Components & Libraries.
JavaScript Style Guide
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot