Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import React, { useState, useEffect } from 'react';
  2. import axios from 'axios';
  3.  
  4. const Tasks = () => {
  5. const [tasks, setTasks] = useState([]);
  6. useEffect(() => {
  7. axios.get('/tasks').then(response => setTasks(response.data));
  8. return (
  9. <ul>
  10. {renderList(tasks)}
  11. </ul>
  12. );
  13. },[]);
  14. };
  15.  
  16. renderList(tasks) {
  17. console.log(tasks)
  18. return <li>dd</li>
  19. }
  20.  
  21. export default Tasks;
  22.  
  23. ./src/compononents/Tasks.js
  24. Line 16: Parsing error: Unexpected token, expected ";"
  25.  
  26. 14 | };
  27. 15 |
  28. > 16 | renderList(tasks) {
  29. | ^
  30. 17 | console.log(tasks)
  31. 18 | return <li>dd</li>
  32. 19 | }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement