Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example: upgrade React example to use React 18
- Loading branch information
Showing
11 changed files
with
224 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
examples/react-example/App.js → examples/react-example/App.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# React example | ||
|
||
This is minimal example created to demonstrate how to integrate Uppy in your | ||
React app. | ||
|
||
To spawn the demo, use the following commands: | ||
|
||
```sh | ||
corepack yarn install | ||
corepack yarn build | ||
corepack yarn workspace @uppy-example/react dev | ||
``` | ||
|
||
If you'd like to use a different package manager than Yarn (e.g. npm) to work | ||
with this example, you can extract it from the workspace like this: | ||
|
||
```sh | ||
corepack yarn workspace @uppy-example/react pack | ||
|
||
# The above command should have create a .tgz file, we're going to extract it to | ||
# a new directory outside of the Uppy workspace. | ||
mkdir ../react-example | ||
tar -xzf examples/react-example/package.tgz -C ../react-example --strip-components 1 | ||
rm -f examples/react-example/package.tgz | ||
|
||
# Now you can leave the Uppy workspace and use the example as a standalone JS project: | ||
cd ../react-example | ||
npm i | ||
npm run dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable */ | ||
import React from 'react' | ||
import { createRoot } from 'react-dom/client'; | ||
import App from './App.jsx' | ||
|
||
import '@uppy/core/dist/style.css' | ||
import '@uppy/dashboard/dist/style.css' | ||
import '@uppy/drag-drop/dist/style.css' | ||
import '@uppy/file-input/dist/style.css' | ||
import '@uppy/progress-bar/dist/style.css' | ||
|
||
createRoot(document.querySelector('#app')).render( | ||
<App /> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
{ | ||
"name": "@uppy-example/react-example", | ||
"name": "@uppy-example/react", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"dependencies": { | ||
"@babel/core": "^7.4.5", | ||
"@babel/preset-react": "^7.0.0", | ||
"babelify": "^10.0.0", | ||
"budo": "^11.6.2", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6" | ||
"@uppy/core": "workspace:*", | ||
"@uppy/dashboard": "workspace:*", | ||
"@uppy/drag-drop": "workspace:*", | ||
"@uppy/file-input": "workspace:*", | ||
"@uppy/google-drive": "workspace:*", | ||
"@uppy/progress-bar": "workspace:*", | ||
"@uppy/react": "workspace:*", | ||
"@uppy/tus": "workspace:*", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
}, | ||
"private": true, | ||
"scripts": { | ||
"css": "cp ../../packages/uppy/dist/uppy.min.css .", | ||
"start": "yarn run css && budo main.js:bundle.js -- -r react:react -r react-dom:react-dom -t babelify" | ||
"dev": "vite", | ||
"build": "vite build", | ||
"preview": "vite preview --port 5050" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-react": "^2.0.0", | ||
"vite": "^3.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
}) |
Oops, something went wrong.