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
Meme Maker -- didn't get it to work #3
base: master
Are you sure you want to change the base?
Meme Maker -- didn't get it to work #3
Conversation
I didn't host it anywhere, so here's a video of it kinda working |
Suggest upload the site and/or video in the future. If you would like help with this... I can help you out :) |
@@ -0,0 +1,44 @@ | |||
import React, { useState } from 'react'; | |||
import logo from './logo.svg'; |
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.
If you are not using the logo, it is better to clean everything you do not need before starting work
import ImageEditor from './components/ImageEditor'; | ||
|
||
function App() { | ||
const [imgURL, setImgURL] = useState(null); |
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.
No need to add "null" you can leave the useState empty
const [imgURL, setImgURL] = useState(null); | ||
const [uploaded, setUploaded] = useState(false); | ||
|
||
const handleUpload = (event) => { |
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.
pYou could deconstruct the event earlier, to make it more readable and easy to work with the const handleUpload = ({target: {files}) => {
Here more info: https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Operadores/Destructuring_assignment
|
||
const handleUpload = (event) => { | ||
setImgURL(URL.createObjectURL(event.target.files[0])); | ||
console.log(event.target.files[0]); |
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.
You can delete the console.log once you have finished developing
}; | ||
|
||
const fileUploader = ( | ||
<div class="file"> |
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.
Although it allows you to use "class" it recommends you and you should always use "className" to avoid mistakes and to respect the recommendations that React makes you
more info here: facebook/react#13525 (comment)
<input | ||
type="file" | ||
className="file-input" | ||
onChange={(event) => handleUpload(event)} |
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.
If you don't activate the function you don't need to add an anonymous function. This way it is cleaner:
onChange={handleUpload}
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.
Good work!
@@ -0,0 +1,118 @@ | |||
import React, { useState } from 'react'; | |||
const ImageEditor = (props) => { |
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.
Here you can destructuring props
const convertToImage = () => { | ||
//getting the SVG data | ||
const svg = document.querySelector('svg'); | ||
let xml = new XMLSerializer().serializeToString(svg); |
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 that here you can use "const"
dominantBaseline="middle" | ||
style={textStyle} | ||
> | ||
{topText} |
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.
Can you add "topTex" in tag HTML
className="input" | ||
type="text" | ||
value={topText} | ||
onChange={(e) => setTopText(e.target.value)} |
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.
In the arrow function if you only have one argument, you don't need to put it in parentheses
The application looks very good, the code is quite readable and I have not found any major flaw. Congratulations |
No description provided.