Em biết anh không chuyên React nhưng em đăng hi vọng mọi người có thể support. Em muốn hỏi sự khác biệt sử dụng redux, react useReducer và việc sử dụng setState. Trong trường hợp nào nên dùng vũ khí nào
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Mình chưa rõ câu hỏi của bạn lắm, nhưng mình nghĩ bạn đang cần phân biệt khi sử dụng redux và useContext để quản lý global state. Sự khác nhau giữa hai thằng này như sau:
Thường thì sẽ dự án sẽ dùng một trong hai, đôi khi có thể kết hợp cả hai. Đi làm thì mình dùng nhiều redux hơn. Còn về setState là 1 hook giúp quản lý dữ liệu ở chỉ ở component, ko share dữ liệu được. Mình tham khảo link ở đây, dịch sang tiếng việt nhiều chỗ thực sự khó, bạn có thể đọc tiếng anh nhé: https://www.geeksforgeeks.org/whats-the-difference-between-usecontext-and-redux/?fbclid=IwAR0JKOFJXMxfgnHrE4iGWvYro9clnENs1IJr1C4GoDdFZQmik9MJBjwBq-U