Skip to content

Commit 7aa1539

Browse files
committed
using vite and react 18 with leva GUI
1 parent 700039d commit 7aa1539

20 files changed

+2711
-32167
lines changed

.gitignore

+21-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3-
# dependencies
4-
/node_modules
5-
/.pnp
6-
.pnp.js
7-
8-
# testing
9-
/coverage
10-
11-
# production
12-
/build
13-
14-
# misc
15-
.DS_Store
16-
.env.local
17-
.env.development.local
18-
.env.test.local
19-
.env.production.local
20-
1+
# Logs
2+
logs
3+
*.log
214
npm-debug.log*
225
yarn-debug.log*
236
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

README.md

+7-25
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,25 @@
11
# threejs-react-wrapper
22

3-
Simple wrapper to run vanilla Threejs code inside a React component.
3+
Simple wrapper to run vanilla ThreeJS code inside a React component.
44

5-
Using React 17.0.2 with functional components and hooks. React code based on [Create React App](https://github.com/facebook/create-react-app) (as of April 2021).
5+
Using a [Leva](https://github.com/pmndrs/leva) GUI to show passing props into ThreeJS.
66

7-
This template handles running regular ES6 Threejs code (as provided in the Threejs examples) inside a bigger React site. Handles loading / unloading and hot-reloads.
7+
Using React 18 and Vite server. (Latest as of April 2023).
88

99
## Philosophy
1010

11-
[react-three-fiber](https://github.com/pmndrs/react-three-fiber) is great if you love React and want to write your 3D code with JSX and hooks. If you prefer coding Threejs with vanilla JS / ES6 classes / modules, this template might be useful for you.
11+
[react-three-fiber](https://github.com/pmndrs/react-three-fiber) is great if you want to write your 3D code with JSX. If you prefer coding Threejs with vanilla JS / ES6 classes / modules, this template might be useful for you.
1212

1313
## Available Scripts
1414

1515
In the project directory, you can run:
1616

17-
### `npm install`
17+
`npm install` - Install dependencies.
1818

19-
Install dependencies.
19+
`npm run dev` - Runs the app in the dev mode.
2020

21-
### `npm start`
22-
23-
Runs the app in the development mode.\
24-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
25-
26-
The page will reload if you make edits.\
27-
You will also see any lint errors in the console.
28-
29-
### `npm run build`
30-
31-
Builds the app for production to the `build` folder.\
32-
It correctly bundles React in production mode and optimizes the build for the best performance.
33-
34-
The build is minified and the filenames include the hashes.\
35-
Your app is ready to be deployed!
21+
`npm run build`
3622

3723
## ScreenShot
3824

3925
![ScreenShot](./screen-shot.png 'ScreenShot')
40-
41-
## TODO
42-
43-
- handle async loading within ThreeWrapper (e.g load config data or assets before three init completes)

index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)