Giter VIP home page Giter VIP logo

million-react's Introduction

⚛️ Million + React

Quick Start

The easiest way to use Million is to open it in StackBlitz:

Open in StackBlitz

If you want to use it locally, you can either fork the project, or clone it directly.

git clone https://github.com/aidenybai/million-react.git
cd million-react
npm install

Once you've done that, open src/App.jsx and start tinkering!

Usage

This is a Vite project. There are two ways to run it:

  • npm run dev: runs the project in development mode.
  • npm run build: bundles the project for production.

License

Million is MIT-licensed open-source software and research project by Aiden Bai.

million-react's People

Contributors

aidenybai avatar nooobcoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

million-react's Issues

Question re Fiber support

Good morning and thanks for this exciting project!

Like many developers who want to use the best possible practices and stack for new React SPA projects. For me, this means Vite and friends and very possibly million.

HOWEVER, it also seems natural that I would want to use Suspense in my routes. I could imagine that it could look something like this:

import { StrictMode, Suspense, lazy } from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { ErrorBoundary, LazyLoadingFallbackUI } from './components';

const LandingPage = lazy(() => import('./pages/landingPage'));

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
	<StrictMode>
		<ErrorBoundary>
			<BrowserRouter>
				<Suspense fallback={<LazyLoadingFallbackUI />}>
					<Routes>
						<Route path="/" element={<LandingPage />} />
					</Routes>
				</Suspense>
			</BrowserRouter>
		</ErrorBoundary>
	</StrictMode>
);

It would put me off, reasobably or otherwise, and would likely act as a blocker to adoption at companies, reasonably or otherwise.

Can I know more about your thoughts on this? What is the thinking behind this choice? Is it perhaps on some roadmap? It is undesirable or simply irrelevant in some way?

While I think it could be the case that I am labouring under misunderstandings about the scope or even the purpose/functionality of million, I suspect that I would not be alone in this and would love to better understand.

Catch boundary support?

I noticed the limitations section and I'm mostly fine with it, but I want to make sure that catch boundaries are supported. In react those have to be class components which have limited support. Do you know whether catch boundaries will work with million?

This is pretty cool but not really a compat layer...yet?

Hey, saw your post on the orange website,

I've known about millionjs before but I've not used it.
What I have used is Preact which also has a compat layer.
You claim that

While alternative libraries like Preact reduce bundle sizes by efficient code design, Million takes it a step further by leveraging compilation to make a quantum leap in improving bundle size and render speed.

Think of it as if React's API and Svelte's compiler had a baby. A baby with super speed! 👶

But this cannot really be called a replacement for neither React nor Preact since it doesn't work with any library that uses the most basic APIs like Fragment, Children etc (which you have already noted as Limitations).

Do you plan to bring up Millionjs-react-compat to Preact level where I can drop in React based libraries and it will JustWork™ or it's just supposed to be a "React like" compat similar to InfernoJS?

Streaming support

React 18's support for streaming enables an incredible upcoming feature for Remix called "defer" which provides a fantastic UX and DX. Any plan to support streaming with suspense?

Build failing when I wrap component with block 😢

I have following code

import React from 'react';
import { block } from 'million/react';

const A : React.FC =()=>{
return <h1> HI</h1>;
};

export const ABlock = block(A);

I added _million.vite() in the plugins array too. But getting the following error. If I don't use block it's working fine.

[vite-plugin-pwa:build] [vite]: Rollup failed to resolve import "react-dom/client" from "../../../node_modules/.pnpm/[email protected]/node_modules/million/dist/react.mjs".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "react-dom/client" from "../../../node_modules/.pnpm/[email protected]/node_modules/million/dist/react.mjs".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at onRollupWarning (file:///Users/sravanth/Documents/mono/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-71eb12cb.js:43609:19)
    at onwarn (file:///Users/sravanth/Documents/mono/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-71eb12cb.js:43399:13)
    at Object.onwarn (file:///Users/sravanth/Documents/mono/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:23263:13)
    at ModuleLoader.handleResolveId (file:///Users/sravanth/Documents/mono/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:22158:26)
    at file:///Users/sravanth/Documents/mono/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:22119:26

```
 ELIFECYCLE  Command failed with exit code 1.

Unexpected reserved word

I'v tried to use this const files = import.meta.glob('./posts/blog/*'); and got the error below.

Screenshot 2022-06-17 at 21 33 25

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.