Convert Figma logo to code with AI

remaxjs logoremax

使用真正的 React 构建跨平台小程序

4,569
364
4,569
145

Top Related Projects

7,994

🐰 Rax is a progressive framework for building universal application. https://rax.js.org

35,461

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/

Essential UI blocks for building mobile web apps.

15,336

A framework in react community ✨

16,243

🌱 React and redux based, lightweight and elm-style framework. (Inspired by elm and choo)

Quick Overview

Remax is a framework for building cross-platform miniapps using React. It allows developers to create applications for multiple platforms such as WeChat, Alipay, and Toutiao using a single codebase, leveraging the power and flexibility of React.

Pros

  • Cross-platform development: Build for multiple miniapp platforms with one codebase
  • Familiar React ecosystem: Utilize React's component-based architecture and ecosystem
  • TypeScript support: Built-in TypeScript support for improved type safety and developer experience
  • Hot reloading: Faster development with hot reloading capabilities

Cons

  • Learning curve: Requires knowledge of React and understanding of miniapp platforms
  • Limited to miniapp ecosystems: Not suitable for native mobile or web development
  • Platform-specific features: Some platform-specific features may require additional work or workarounds
  • Community size: Smaller community compared to more established frameworks

Code Examples

  1. Creating a simple component:
import * as React from 'react';
import { View, Text } from 'remax/wechat';

export default function HelloWorld() {
  return (
    <View>
      <Text>Hello, World!</Text>
    </View>
  );
}
  1. Using hooks for state management:
import * as React from 'react';
import { View, Button } from 'remax/wechat';

export default function Counter() {
  const [count, setCount] = React.useState(0);

  return (
    <View>
      <Text>Count: {count}</Text>
      <Button onTap={() => setCount(count + 1)}>Increment</Button>
    </View>
  );
}
  1. Handling user input:
import * as React from 'react';
import { View, Input, Text } from 'remax/wechat';

export default function NameInput() {
  const [name, setName] = React.useState('');

  return (
    <View>
      <Input
        type="text"
        placeholder="Enter your name"
        value={name}
        onInput={(e) => setName(e.target.value)}
      />
      <Text>Hello, {name}!</Text>
    </View>
  );
}

Getting Started

  1. Install Remax CLI:
npm install remax -g
  1. Create a new Remax project:
remax create my-app
cd my-app
  1. Start the development server:
npm run dev
  1. Build for production:
npm run build

For more detailed instructions and platform-specific configurations, refer to the official Remax documentation.

Competitor Comparisons

7,994

🐰 Rax is a progressive framework for building universal application. https://rax.js.org

Pros of Rax

  • Broader ecosystem support, including web and native platforms
  • Larger community and backing from Alibaba
  • More comprehensive documentation and examples

Cons of Rax

  • Steeper learning curve due to its multi-platform nature
  • Less focused on WeChat mini-program development
  • Potentially more complex setup for simple projects

Code Comparison

Remax (React-like syntax for WeChat mini-programs):

import * as React from 'react';
import { View, Text } from 'remax/wechat';

export default () => (
  <View>
    <Text>Hello, Remax!</Text>
  </View>
);

Rax (Universal React-like framework):

import { createElement, render } from 'rax';
import View from 'rax-view';
import Text from 'rax-text';

function App() {
  return (
    <View>
      <Text>Hello, Rax!</Text>
    </View>
  );
}

render(<App />);

Both frameworks use React-like syntax, but Rax's universal approach requires platform-specific components (e.g., rax-view instead of View). Remax focuses on WeChat mini-program development, while Rax aims for cross-platform compatibility, including web and native platforms.

35,461

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/

Pros of Taro

  • Supports multiple frameworks (React, Vue, Nerv) and platforms (WeChat, Alipay, etc.)
  • Larger community and ecosystem with more plugins and components
  • More comprehensive documentation and examples

Cons of Taro

  • Steeper learning curve due to its multi-framework nature
  • Potentially slower build times for complex projects
  • May introduce additional abstraction layers, impacting performance

Code Comparison

Taro (React):

import { View, Text } from '@tarojs/components'

function MyComponent() {
  return (
    <View className='my-component'>
      <Text>Hello, Taro!</Text>
    </View>
  )
}

Remax:

import { View, Text } from 'remax/wechat'

function MyComponent() {
  return (
    <View className='my-component'>
      <Text>Hello, Remax!</Text>
    </View>
  )
}

Both frameworks use similar syntax for creating components, with minor differences in import statements and available components. Taro's approach is more platform-agnostic, while Remax is more focused on specific platforms like WeChat.

Essential UI blocks for building mobile web apps.

Pros of Ant Design Mobile

  • Comprehensive UI component library specifically designed for mobile applications
  • Extensive documentation and community support
  • Seamless integration with React and React Native projects

Cons of Ant Design Mobile

  • Limited cross-platform compatibility compared to Remax
  • Heavier bundle size due to the extensive component library
  • Steeper learning curve for developers new to the Ant Design ecosystem

Code Comparison

Ant Design Mobile:

import { Button } from 'antd-mobile';

const MyComponent = () => (
  <Button color='primary' size='large'>
    Click me
  </Button>
);

Remax:

import { Button } from 'remax/wechat';

const MyComponent = () => (
  <Button type='primary' size='default'>
    Click me
  </Button>
);

While both libraries provide similar components, Remax focuses on cross-platform development for mini-programs, offering a more unified API across different platforms. Ant Design Mobile, on the other hand, provides a richer set of pre-designed components specifically tailored for mobile web and React Native applications.

Remax excels in its ability to create applications for multiple mini-program platforms using a single codebase, whereas Ant Design Mobile shines in its comprehensive mobile-first design system and extensive component library for React-based projects.

15,336

A framework in react community ✨

Pros of umi

  • More comprehensive framework with built-in routing, state management, and plugins
  • Supports server-side rendering and static site generation
  • Larger ecosystem and community support

Cons of umi

  • Steeper learning curve due to more features and complexity
  • May be overkill for smaller projects or those focused solely on mini-programs
  • Less specialized for cross-platform mini-program development

Code Comparison

umi (configuring routes):

export default {
  routes: [
    { path: '/', component: '@/pages/index' },
    { path: '/users', component: '@/pages/users' },
  ],
};

Remax (defining pages):

// app.config.js
module.exports = {
  pages: ['pages/index/index', 'pages/users/index'],
};

Key Differences

  • Remax focuses on cross-platform mini-program development, while umi is a more general-purpose React framework
  • umi provides a more opinionated structure and built-in features, whereas Remax offers more flexibility for mini-program specific requirements
  • Remax uses a simpler configuration approach, while umi has more advanced configuration options for various scenarios

Both frameworks have their strengths, with umi being more suitable for complex web applications and Remax excelling in cross-platform mini-program development.

16,243

🌱 React and redux based, lightweight and elm-style framework. (Inspired by elm and choo)

Pros of dva

  • Lightweight and easy-to-use Redux framework for React applications
  • Integrates Redux, Redux-saga, and react-router in a cohesive package
  • Supports plugin system for extending functionality

Cons of dva

  • Limited to React ecosystem, not suitable for cross-platform development
  • Steeper learning curve for developers unfamiliar with Redux and Redux-saga
  • Less active maintenance compared to Remax

Code Comparison

dva:

import dva from 'dva';
const app = dva();
app.model({
  namespace: 'count',
  state: 0,
  reducers: { add(state) { return state + 1; } },
});

Remax:

import * as React from 'react';
import { View, Text } from 'remax/one';
export default () => (
  <View>
    <Text>Hello, Remax!</Text>
  </View>
);

dva focuses on state management and routing for React applications, while Remax is designed for cross-platform mini-program development. dva provides a more opinionated structure for large-scale applications, whereas Remax offers flexibility for building UIs across different platforms. The code examples highlight dva's emphasis on state management and Remax's focus on UI components.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Learn once, write anywhere
使用真正的 React 构建小程序

CI build status Codecov npm dingding

《使用 React 开发小程序》

Remax 将 React 运行在小程序环境中,让你可以使用完整的 React 进行小程序开发。

  • 真正的 React - 不同于静态编译的方案,在 Remax 中使用 React 没有任何限制,包括 React Hooks。你可以把 Remax 理解为针对小程序的 React Native。
  • 多端支持 - 使用 Remax 把代码转换到多个小程序平台。
  • TypeScript - 完整的 TypeScript 支持,给你满满的安全感。

文档

你可以从我们的网站上找到详细的文档。

也可以通过快速开始指南来立即体验 Remax。

示例

https://github.com/remaxjs/examples

贡献者

查看《贡献指南》

协议

MIT

NPM DownloadsLast 30 Days