Skip to content

martovcompany/react-three-next

 
 

Repository files navigation

David David Downloads Discord Shield Lighthouse Global

🏯 React-Three-Next starter

First Load JS of 76Kb. This starter will automatically pick the marked R3F components and inject them into a canvas layout so we can navigate seamlessly between the pages with some dynamic dom and canvas content without reloading or creating a new canvas every time.

⚫ Demo :

image

How to use

Installation

Tailwind is the default and only stable

yarn create r3f-app next my-app

or

npx create-r3f-app next my-app

🗻 Features

  • Automatically inject r3f component in the Canvas
  • Support glsl imports
  • PWA Support
  • Layout for Canvas and DOM
  • Template for the meta data and header
  • Clean code using ESlint and Prettier
  • Use esbuild in development for faster HMR
  • VSCode debug profiles for the server, Chrome, and Firefox

🛂 Typescript

If you want to use typescript:

  • create a tsconfig.json file
  • start the dev server, next will fill the tsconfig.json and tell you to install typescript
  • yarn add --dev typescript @types/react
  • copy the path aliases from jsconfig.json to tsconfig.json

🚄 Architecture

Inform the nextjs page that the component is a Threejs component. For that, simply add the r3f property to the parent component.

const Page = () => {
  return (
    <>
      <div>Hello !</div>
      {/* Simply add the r3f prop to the parent component -> */}
      <MeshComponent r3f />
    </>
  )
}

export default Page

🎛️ Available Scripts

  • yarn dev - Next dev
  • yarn analyze - Generate bundle-analyzer
  • yarn lint - Audit code quality
  • yarn build - Next build
  • yarn start - Next start
  • yarn export - Export to static HTML

⬛ Stack

  • threejs – A lightweight, 3D library with a default WebGL renderer.
  • @react-three/fiber – A React renderer for Threejs on the web and react-native.
  • @react-three/drei – useful helpers for react-three-fiber
  • @react-three/a11y – Accessibility tools for React Three Fiber
  • tailwind – A utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 directly in your markup.
  • r3f-perf - Optional – Tool to easily monitor react threejs performances.

How to contribute :

git clone https://github.com/pmndrs/react-three-next
&& cd react-three-next && yarn install

Maintainers :

About

React Three Fiber, Nextjs, Tailwind starter

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.7%
  • CSS 1.5%
  • Other 0.8%