- Mastering React Test:Driven Development
- Daniel Irvine
- 108字
- 2021-06-24 14:45:05
Selecting data to view
Let's add in some dynamic behavior to our page. We'll make each of the list items a link that the user can click on to view that appointment.
Thinking through our design a little, there are a few pieces we'll need:
- A button element within our li
- An onClick handler that is attached to that button element
- A component state to record which appointment is currently being viewed
When we test React actions, we do it by observing the consequences of those actions. In this case, we can click on a button and then check that its corresponding appointment is now rendered on screen.
推薦閱讀
- Learning C# by Developing Games with Unity 2020
- Python 3.7網(wǎng)絡(luò)爬蟲(chóng)快速入門(mén)
- 深入淺出Windows API程序設(shè)計(jì):編程基礎(chǔ)篇
- PhpStorm Cookbook
- Building an RPG with Unity 2018
- Learning Raspbian
- Unity UI Cookbook
- Raspberry Pi Home Automation with Arduino(Second Edition)
- OpenCV 4計(jì)算機(jī)視覺(jué)項(xiàng)目實(shí)戰(zhàn)(原書(shū)第2版)
- 深入淺出React和Redux
- Getting Started with Nano Server
- Mockito Essentials
- Appcelerator Titanium:Patterns and Best Practices
- Zend Framework 2 Cookbook
- 面向物聯(lián)網(wǎng)的Android應(yīng)用開(kāi)發(fā)與實(shí)踐