Guest User

JSX code

a guest
Sep 29th, 2019
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. postIsClicked(e) {
  2. console.log("clicked");
  3. if(e.target.name === "Yes") {
  4. console.log("Yes has been clicked");
  5. } else if(e.target.name === "No") {
  6. console.log("No has been clicked");
  7. }
  8. }
  9. ___________________________________________________________________________________________________________________________
  10. <label className="upload-button button is-success is-outlined"
  11. htmlFor="new_post_image">Upload</label>
  12.  
  13. <br/>
  14. {
  15. this.state.imageChosen ?
  16. <div className="uploaded-pics">
  17. <ImagePreview src={this.state.previewImgURL} onClick={this.postIsClicked} name={"Yes" && "No"}/>
  18. </div> : null
  19. }
  20. ___________________________________________________________________________________________________________________________
  21. import React from 'react';
  22.  
  23. const imagePreview = (props) => {
  24. return (
  25. <div className="row">
  26. <div className="preview-wrapper col-md-6 col-sm-6">
  27. <img src={props.src} className="img-fluid"/>
  28. <h1>Would you lke to upload this image?</h1>
  29. <input type="submit" value="Yes" name={props.name} onClick={props.onClick}/>
  30. <input type="submit" value="No" name={props.name} onClick={props.onClick}/>
  31. </div>
  32. </div>
  33. );
  34. };
  35.  
  36. export default imagePreview;
Advertisement
Add Comment
Please, Sign In to add comment