Webinar Preview: “Sharing Props Using Type Information” tutorial step for React+TS+TDD
As a reminder… next Wednesday (Oct 16) I’m giving a webinar on React+TypeScript+TDD in PyCharm. I’m doing some blog posts about material that will be covered.
See the first blog post for some background on this webinar and its topic.
Spotlight: Sharing Props Using Type Information
Now we get to some fun stuff: Sharing Props Using Type Information.
When you have lots of small components, they share information from parent "smart" components to child "dumb" (or presentation) components. This information is shared via properties, which forms the contract.
How do you write down that contract? This is where doing your React projects in TypeScript really shines. You can make an interface for your property information and say that your component’s properties conform to that interface. You gain IDE autocomplete, warnings, and more.
This really shines in TDD. You "fail faster" with visual squiggles that indicate you broke the contract, rather than waiting for the test to run.
This tutorial step shows a React functional component with property information in an interface, along with showing how to allow a default value for a prop. All done from a test-first workflow:
Subscribe to Blog updates
Livestream: “Python, Django, PyCharm, and More”
Join us for the new PyCharm Livestream episode to learn about everything new in the world of Python on January 25 at 4:00 pm UTC.
Join the Webinar: Do You Do Enough Testing? pytest to the Rescue!
Join our webinar on November 21 at 4:00 pm UTC to learn how you can use pytest to find bugs, improve code quality, and even have some fun along the way. We’ll be chatting with Brian Okken about all things pytest, including some live coding examples.
Live stream: Who Is Behind Django? An Interview with the DSF President
We’ve all seen and used the famous Django framework, but there’s a lot more to a successful project than commits. The Django Software Foundation is a hallmark achievement in the Python community, but who’s behind it? In this interview, we’ll be talking with DSF President Chaim Kirby about its histor…