Reader small image

You're reading from  React Key Concepts

Product typeBook
Published inDec 2022
PublisherPackt
ISBN-139781803234502
Edition1st Edition
Right arrow
Author (1)
Maximilian Schwarzmüller
Maximilian Schwarzmüller
author image
Maximilian Schwarzmüller

Academind GmbH - Online Education: Bundling the courses and know-how of successful instructors, Academind strives to deliver high-quality online education. Online education, real-life success—that's what Academind stands for. Learn topics such as web development, data analysis, and more in a fun and engaging way. Maximilian Schwarzmüller: Since the age of 13, Maximilian Schwarzmüller has never stopped learning new programming skills and languages. In the early days, he started creating websites for friends and for fun. This passion has remained and shaped his decision to work as a freelance web developer and consultant. The success and fun he has in this job is immense and really keeps that passion alive. Although he started web development on the backend (PHP with Laravel and NodeJS), he has increasingly become a front-end developer using modern frameworks such as React, Angular, or VueJS 2 in a lot of projects. As a self-taught developer, he had broadened his horizon by studying business administration, resulting in a master's degree. This enabled him to work in a major strategy consultancy as well as a bank. Whilst learning and developing his skills, he realized that he enjoyed development more than these fields. As a self-taught professional, Max is familiar with the difficult topics when learning new or improving on already-known languages. This background and experience enables him to focus on the most relevant key concepts and topics. His track record is the best proof of that. Whether working as a development instructor or teaching business administration, he always receives great feedback. The most rewarding experience is to see how people find new and better jobs, build awesome web applications, acquire amazing projects, or simply enjoy their hobby with the help of his content.
Read more about Maximilian Schwarzmüller

Right arrow

4. Working with Events and State

Learning Objectives

By the end of this chapter, you will be able to do the following:

– Add user event handlers (for example, for reacting to button clicks) to React apps.

– Update the UI via a concept called state.

– Build real dynamic and interactive UIs (that is, so that they are not static anymore).

Introduction

In the previous chapters, you learned how to build UIs with the help of React components. You also learned about props—a concept and feature that enables React developers to build and reuse configurable components.

These are all important React features and building blocks, but with these features alone, you would only be able to build static React apps (that is, web apps that never change). You would not be able to change or update the content on the screen if you only had access to those features. You also would not be able to react to any user events and update the UI in response to such events (for instance, to show an overlay window upon a button click).

Put in other words, you would not be able to build real websites and web applications if you were limited to just components and props.

Therefore, in this chapter, a brand-new concept is introduced: state. State is a React feature that allows developers to update internal data and trigger a UI update...

Feedback

We are constantly looking at improving our content, so what could be better than listening to what you as a reader have to say? Your feedback is important to us and we will do our best to incorporate it. Could you take two mins to fill out the feedback form for this book and let us know what your thoughts are about it? Here's the link: https://packt.link/A8yX4.

Thank you in advance.

This chapter covers the following recipes:

  • Exploring .NET Assemblies
  • Exploring .NET Classes
  • Leveraging .NET Methods
  • Creating a C# Extension
  • Creating a cmdlet

Introduction

Microsoft first launched the Microsoft .NET Framework in June 2000, with the code name Next Generation Windows Services. Amidst a barrage of marketing zeal, Microsoft seemed to add the .NET moniker to every product in its portfolio: Windows .NET Server (later renamed Windows Server 2003), Visual Studio.NET, and even MapPoint .NET.

The .NET Framework provided application developers with a host of underlying features and technologies on which to base their applications. These worked well then (20+ years ago), but newer features later emerged based on advances in the underlying technologies. For example, SOAP (Simple Object Access Protocol) and XML-based web services have given way to REST (Representation State Transfer) and JSON (JavaScript Object Notation).

Microsoft made considerable improvements to the .NET Framework with each release and added new features based on customer feedback. The .NET started as closed-source, but Microsoft transitioned .NET to open source, aka...

3 Exploring .NET

Feedback

We are constantly looking at improving our content, so what could be better than listening to what you as a reader have to say? Your feedback is important to us and we will do our best to incorporate it. Could you take two mins to fill out the feedback form for this book and let us know what your thoughts are about it? Here's the link: https://packt.link/A8yX4.

Thank you in advance.

This chapter covers the following recipes:

  • Exploring .NET Assemblies
  • Exploring .NET Classes
  • Leveraging .NET Methods
  • Creating a C# Extension
  • Creating a cmdlet

Introduction

Microsoft first launched the Microsoft .NET Framework in June 2000, with the code name Next Generation Windows Services. Amidst a barrage of marketing zeal, Microsoft seemed to add the .NET moniker to every product in its portfolio: Windows .NET Server (later renamed Windows Server 2003), Visual Studio.NET, and even MapPoint .NET.

The .NET Framework provided application developers with a host of underlying...

3 Exploring .NET

Feedback

We are constantly looking at improving our content, so what could be better than listening to what you as a reader have to say? Your feedback is important to us and we will do our best to incorporate it. Could you take two mins to fill out the feedback form for this book and let us know what your thoughts are about it? Here's the link: https://packt.link/A8yX4.

Thank you in advance.

This chapter covers the following recipes:

  • Exploring .NET Assemblies
  • Exploring .NET Classes
  • Leveraging .NET Methods
  • Creating a C# Extension
  • Creating a cmdlet

Introduction

Microsoft first launched the Microsoft .NET Framework in June 2000, with the code name Next Generation Windows Services. Amidst a barrage of marketing zeal, Microsoft seemed to add the .NET moniker to every product in its portfolio: Windows .NET Server (later renamed Windows Server 2003), Visual Studio.NET, and even MapPoint .NET.

The .NET Framework provided application developers with a host of underlying...

3 Exploring .NET

Feedback

We are constantly looking at improving our content, so what could be better than listening to what you as a reader have to say? Your feedback is important to us and we will do our best to incorporate it. Could you take two mins to fill out the feedback form for this book and let us know what your thoughts are about it? Here's the link: https://packt.link/A8yX4.

Thank you in advance.

This chapter covers the following recipes:

  • Exploring .NET Assemblies
  • Exploring .NET Classes
  • Leveraging .NET Methods
  • Creating a C# Extension
  • Creating a cmdlet

Introduction

Microsoft first launched the Microsoft .NET Framework in June 2000, with the code name Next Generation Windows Services. Amidst a barrage of marketing zeal, Microsoft seemed to add the .NET moniker to every product in its portfolio: Windows .NET Server (later renamed Windows Server 2003), Visual Studio.NET, and even MapPoint .NET.

The .NET Framework provided application developers with a host of underlying...

Creating a C# Extension

For most day-to-day operations, the commands provided by PowerShell, from Windows features, or third-party modules, provide all the functionality you need to manage your systems. In some cases, as you saw in “Leveraging .NET Methods,” commands do not exist to achieve your goal. In those cases, you can use the methods provided by .NET.

There are also cases where you need to perform more complex operations without PowerShell cmdlet or direct .NET support. You may, for example, have a component of an ASP.NET web application written in C#, but you now wish to repurpose it for administrative scripting purposes.

PowerShell makes it easy to add a class, based on .NET language source code, into a PowerShell session. You supply the C#’’ code, and PowerShell creates a .NET class that you can use the same way you use .NET methods (and using virtually the same syntax). You use the Add-Type cmdlet and specify the C# code for your class/type(s). PowerShell...

Creating a cmdlet

As noted previously in this chapter, for most operations, the commands and cmdlets available to you natively provide all the functionality you need. In the “Creating a C# Extension” recipe, you saw how you could create a class definition and add it to PowerShell. In some cases, you may wish to expand on the class definition and create a custom cmdlet.

Creating a compiled cmdlet requires you to either use a tool such as Visual Studio or use the free tools provided by Microsoft as part of the .NET Core Software Development Kit (SDK). The free tools in the SDK are more than adequate to help you to create a cmdlet using C#. Microsoft’s Visual Studio, whether the free community edition or the commercial releases, is a rich and complex tool whose inner workings are well outside the scope of this book.

As in the “Creating a C# Extension,” an important question you should be asking is when/why you should create a cmdlet? Aside from the perennial...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
React Key Concepts
Published in: Dec 2022Publisher: PacktISBN-13: 9781803234502
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Maximilian Schwarzmüller

Academind GmbH - Online Education: Bundling the courses and know-how of successful instructors, Academind strives to deliver high-quality online education. Online education, real-life success—that's what Academind stands for. Learn topics such as web development, data analysis, and more in a fun and engaging way. Maximilian Schwarzmüller: Since the age of 13, Maximilian Schwarzmüller has never stopped learning new programming skills and languages. In the early days, he started creating websites for friends and for fun. This passion has remained and shaped his decision to work as a freelance web developer and consultant. The success and fun he has in this job is immense and really keeps that passion alive. Although he started web development on the backend (PHP with Laravel and NodeJS), he has increasingly become a front-end developer using modern frameworks such as React, Angular, or VueJS 2 in a lot of projects. As a self-taught developer, he had broadened his horizon by studying business administration, resulting in a master's degree. This enabled him to work in a major strategy consultancy as well as a bank. Whilst learning and developing his skills, he realized that he enjoyed development more than these fields. As a self-taught professional, Max is familiar with the difficult topics when learning new or improving on already-known languages. This background and experience enables him to focus on the most relevant key concepts and topics. His track record is the best proof of that. Whether working as a development instructor or teaching business administration, he always receives great feedback. The most rewarding experience is to see how people find new and better jobs, build awesome web applications, acquire amazing projects, or simply enjoy their hobby with the help of his content.
Read more about Maximilian Schwarzmüller