chiewm / react-three-next

React Three Fiber, Nextjs, Tailwind and Styled-components starter

Home Page:https://react-three-next.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Downloads Discord Shield

🏯 React-Three-Next starter

Minimalist starter, First Load JS of 85Kb. 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 style. styled-components (styled) is also available.

yarn create r3f-app next my-app
# yarn create r3f-app <next> my-app <tailwind|styled>? -ts?

or

npx create-r3f-app next my-app

πŸ›‚ Typescript

For typescript add the parameter -ts or --typescript:

yarn create r3f-app next my-app -ts

or

npx create-r3f-app next my-app -ts

πŸ—» 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
  • VSCode debug profiles for the server, Chrome, and Firefox

πŸš„ 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 = (props) => {
  return (
    <>
      <div>Hello !</div>
      
    </>
  )
}
// canvas components goes here
// It will receive same props as Page component (from getStaticProps, etc.)
Page.r3f = (props) => (
  <>
    <Shader />
  </>
)

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

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 and Styled-components starter

https://react-three-next.vercel.app/

License:MIT License


Languages

Language:JavaScript 95.6%Language:GLSL 2.7%Language:CSS 1.7%