Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. handleOnClick = () => {
  2. fetch(proxyUrl + targetUrl)
  3. .then(res => res.json())
  4. .then(shop => {
  5. console.table(shop); // create table in console
  6. this.setState({
  7. shop ,
  8. isLoading:false,
  9. });
  10. })
  11. .catch(e => {
  12. console.log(e);
  13. });
  14. } ;
  15.  
  16. constructor() {
  17. super();
  18. function handleOnClick() {
  19. fetch(proxyUrl + targetUrl)
  20. .then(res => res.json())
  21. .then(shop => {
  22. console.table(shop); // create table in console
  23. this.setState({
  24. shop ,
  25. isLoading:false,
  26. });
  27. })
  28. .catch(e => {
  29. console.log(e);
  30. });
  31. } ;
  32. }
  33.  
  34. handleOnClick();
  35.  
  36. state = {
  37. isLoading: true,
  38. shop: null,
  39. error: null
  40. };
  41.  
  42. setState({shop ,isLoading:true}).then(this.setState({ shop , isLoading:false }); })
  43.  
  44. handleSubmit(e) {
  45. e.preventDefault();
  46. this.forceUpdate();
  47. .
  48. .
  49. .
  50. .
  51. onClick={() => {console.log("test"); this.forceUpdate()} }
  52.  
  53. constructor(){
  54. super();
  55. this.forceUpdateHandler = this.forceUpdateHandler.bind(this);
  56. };
  57.  
  58. forceUpdateHandler(){
  59. this.forceUpdate();
  60. };
  61. .
  62. .
  63. .
  64. onClick={() => {console.log("test"); this.forceUpdateHandler()} }>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement