New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example: upgrade React example to use React 18 #4002
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
18 changes: 12 additions & 6 deletions
18
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,8 @@ | ||
/* eslint-disable */ | ||
import React from 'react' | ||
import { createRoot } from 'react-dom/client'; | ||
import App from './App.jsx' | ||
|
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be best to rewrite this to hook to show
useUppy
. We frequently get issues about people forgettinguseUppy
and hooks is what people write these days.