teleren/devto huggingface dataset:
Add event listeners to DOM elements in React
Tags: events, dom
Published: 2023-10-03 18:57:25

---
title: Add event listeners to DOM elements in React
published: true
date: 2023-09-30 00:05:00 UTC
tags: Events,DOM
canonical_url: https://reactjsexample.com/add-event-listeners-to-dom-elements-in-react/
---

# Event Handling in React Lab

## Learning Goals

- Add event listeners to DOM elements in React

## Overview
 ![Add event listeners to DOM elements in React](https://reactjsexample.com/content/images/2023/09/Code_2023-09_18-00-06.jpg)

In this lab, you’ll respond to events in React and write event handlers.

> **Note** : The components are not defined yet, but the files are present. Before the tests will run, you must export components from `EyesOnMe.js` and`Keypad.js`. To get started, write very basic components that you _know_ will not pass all the tests, but at least be valid React.

## Keypad

![Add event listeners to DOM elements in React](https://camo.githubusercontent.com/cf5b211dd1536efd124cfaccd006cc7a2e0b001a3a25fad7be40eed7687e32fa/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f336f364d626454626f5446574f55734c6b632f67697068792e676966)

Mr. Burns has requested us to build a new keypad component for the nuclear plant, since the last one was way too complicated for his employees to use. We’ll keep things super simple instead, and use an `<input type="password" />`field to capture input. Here’s how to complete the exercise:

1. In the `components/Keypad.js` file, create a `Keypad` React component.
2. In that component, render an `input` with the right type.
3. On that `input`, add an event handler that listens for the `change` event.
4. When that event fires, use `console.log` to print out the text `'Entering password...'`.

## Eyes on the ball

Let’s say you’re in the club with your buddy. The music’s blaring, lights are flashing… It’s so hard to get his attention! Your job is to create a component that registers whenever he focuses on you, _and_ when his eyes are drifting off.

1. In the `components/EyesOnMe.js` file, create a `EyesOnMe` React component.
2. In that component, render a `button` with the text `'Eyes on me'`.
3. On that `button`, add event handlers that listen for the `focus` and `blur` events.
4. When the `focus` event fires, use `console.log` to print out the text `'Good!'`.
5. When the `blur` event fires, use `console.log` to print out the text `'Hey! Eyes on me!'`.

## Resources

- [React Events](https://reactjs.org/docs/events.html)

## GitHub

[View Github](https://github.com/manyshyn/react-hooks-event-handling-lab?ref=reactjsexample.com)
Blockchain Dev Decline: Advice for Specialists?
Tags: discuss
Published: 2023-09-30 00:00:00

---
published_at : 2023-09-30 00:00 +0000
---

>  As blockchain development sees a shift, what advice would you offer to developers who previously specialized in this field? 

Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
Working with Parallel Branches
Published: 2023-09-29 23:30:50

This week in my Open Source Development course, I was tasked with adding two new features to my Open Source project repo, [TILerator](https://github.com/mismathh/TILerator), while working on these features in separate branches and merging them once complete. TILerator is a command-line tool that is able to convert `.txt` or `.md` files into a `.html` file with the correct `HTML` tags. 

<h2><u>New Features</u></h2>
<h3>Adding Appropriate Error/Exit Codes for All Cases</h3>
The first feature I decided to implement was [appropriate exit codes](https://github.com/mismathh/TILerator/issues/10) throughout my program. Initially, I had a `console.log()` message describing the state of the program (success/failure), but adding these exit codes provides a more robust method of identifying errors.  The program now exits with a code of `0` upon a successful execution and a non-zero exit code (-1) in case of errors. The merge commit can be found [here](https://github.com/mismathh/TILerator/commit/0a30c9db4bd1e388f1c74d92cc1de3f04db73935).

```javascript
else if (input.length === 1 && !input[0].startsWith("-")) {
    utils.determinePath([input[0]]);
    process.exit(0);
  } else {
    console.error(
      "Invalid arguments provided. Enter TILerator --help for more information.\n"
    );
    process.exit(-1);
  }
```

<h3>Adding Support for Inline and Fenced Code Blocks</h3>
The second feature I decided to implement was support for [inline/fenced code blocks](https://github.com/mismathh/TILerator/issues/11) for `.md` files. 
The merge commit can be found [here](https://github.com/mismathh/TILerator/commit/3d7ac7d6d8252a9b0324e495134b4a462088c2fa).

<b>For inline code blocks:</b> Text that is enclosed by a single backtick 
```
`console.log(`TILerator tool version: ${version}`);`
```
would get rendered as 
```
<code>console.log(`TILerator tool version: ${version}`);</code>
```

<b>For fenced code blocks:</b> Text that is enclosed by 3 backticks
```
    ```
    console.log(`TILerator tool version: ${version}`);
    ```
```
would get rendered as 
```
<pre>
   <code>
      console.log(`TILerator tool version: ${version}`);
   </code>
</pre>
```

Merging these two branches into `main` went quite smoothly with no conflicts, primarily due to these two features being implemented in different areas.

Overall, I have learned the concepts of parallel branches and merging. Creating separate branches is an effective method to testing out new features in an isolated environment without affecting the main branch.
How to set up path Alias in react.
Published: 2023-09-29 23:19:09

I'm not sure if this is the right title for this, but it took me a while to find a solution for this, So i'm keeping this here.

> Note: I'm assuming you are using react with vite.

Add this to the tsconfig.json file under the compilerOptions object.

```
"baseUrl": ".",
"paths": {
  "@/*": ["./src/*"]
}
```

Install @types/node to dev dependency for type safety for importing from the path module.

```
yarn add -d @types/node
```

And change the vite.config.ts to understand the @ sign as well as an alias of the "src" folder.

```
import path from 'path'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
})
```

Solution was extracted from [Borris](https://linkb.hashnode.dev/bunsh-with-react-typescript-tailwindcss-and-storybook) article.

End.
Aerc Mail Setup and Send Email Using Neovim
Tags: neovim, aerc, email, terminal
Published: 2023-09-29 23:17:45



```
gpg --gen-key

```

```
pass init email@domain.com 
```

```
pass insert email@domain.com
```

```
pass show email@domain.com 
```

```
sudo apt install aerc 
aerc 
```
+ create email account - follow 
https://aerc-mail.org/ video 

account.conf
```
[YouMailAccount]
source = impas://email%40xyx.com@email.xyz.com
source-cred-cmd = pass show email@xyx.com
outgoing= smtps+plain://email%40xyx.com@email.xyz.com
outgoing-cred-cmd = pass show email@xyx.com
default = INBOX
from = John Doe <email@xyx.com> 
copy-to = Sent 
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7km2kv1tayafyaewog6.png)
The Start of My Year-long Journey into AI: From Novice to Engineer
Tags: beginners, ai, llm, datascience
Published: 2023-09-29 22:53:03

**The world of AI is evolving, and so am I.**

LangChain, LLMs, Knowledge Graphs, LlamaIndex (I genuinely thought this was a meme when I first heard the name) — these terms are now omnipresent.

It's official: one can't work in any field without encountering AI and LLMs, as evidenced by Google, OpenAI, and Microsoft to name a few. My ultimate goal is not just to bear the title of an AI Engineer but to truly possess its corresponding skills and responsibilities. However, given the current employer-driven market and recent tech layoffs, I realize the importance of expanding my expertise and executing relevant projects.

I intend to embark on a project-based, self-learning journey, primarily using free resources, and will share updates on my progress. Expect two types of posts: daily snippets providing a quick overview of my activities, and more in-depth monthly reports showcasing significant projects, breakthroughs, or even the setbacks and errors I encounter.

From October 2023 to October 2024, I'm dedicating a segment of my day to this venture. At the journey's conclusion, I plan to compile and share these resources for anyone who might find themselves in a similar situation. Wish me luck!

P.S. I'm not expecting to jump from Data Analyst to AI Engineer within a year but to progressively go from Data Analyst to Data Scientist to AI Engineer. What I expect in this year long journey is to have the foundations necessary to get to the next step of becoming an AI Engineer.

Do you have any insights, suggestions, or similar experiences to share? I'd love to hear from you!
Data Science for Beginners:
Published: 2023-09-29 22:23:48

###_2023-2024 Complete Roadmap_

Data scientists work to deeply understand and analyze data to provide actionable insights. They develop strategies to capture, gather and clean data from a range of sources after which they explore these data to build solutions and communicate their findings.

For the intellectually curious with an analytical mindset who love working with data, I’ll share with you these few simple steps on how to become a data scientist:

1. Having an educational background in mathematics, statistics, and computer science with a solid understanding in concepts like probability, linear algebra and calculus to perform data analysis effectively.

2. Develop proficiency in programming languages like Python and R, which are widely used in data science for data manipulation and analysis.

3. Master data manipulation and cleaning techniques, as data quality is crucial using SQL. Learn how to use tools like Pandas for data preprocessing.

4. Gain expertise in machine learning algorithms, both supervised and unsupervised. Learn how to implement models, tune them, and evaluate their performance.

5. Develop data visualization skills using libraries like Matplotlib to present findings effectively. Power BI and Tableau can also be learned for data visualization.

6. Familiarize yourself with big data tools like Hadoop and Spark for handling large datasets efficiently.

7. Work on personal projects and build a portfolio showcasing your data science skills. Participate or contribute to open-source projects to gain practical experience.

Summarily, data science requires three basic skills which are mathematical, programming and communication skills with a high level of curiosity. With data science as a rapidly evolving field, continuous learning and staying updated with industry trends are essential as well. Networking with professionals can also help you on your journey to becoming a data scientist.
Day 822 : Feels So Good
Tags: hiphop, code, coding, lifelongdev
Published: 2023-09-29 22:05:57

_liner notes_:
- Professional : Finally submitted my expenses for September. Did a training. Followed up on a community question to make sure the member got my response from yesterday. The day flew by!

- Personal : Last night, I went through Bandcamp and picked up some projects and got the posts ready for different social media platforms.

![North Cascades, WA, USA landscape with tall pine trees in the foreground with mountains extending into the distance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7l59j2yozhins99vmvt.jpg)

Going to put together tracks for the radio show. Luckily, I don't have to do too many because I still have leftovers from what I prepared for my trip. Feels so good to see all the prep work I did previously make things a little easier for me in the present. Still going to try and stay ahead though. Also want to see if I can catch up on some anime. In addition to the radio show on Saturday, I'll probably do my study sessions on Sunday over at https://untilit.works

Have a great night and weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube y-V4nbUjUfQ %}
Shopify custom headings - possible to add 2 fonts simultaneously into a heading?
Tags: webdev, css, development, shopify
Published: 2023-09-29 22:03:12

Bit of a strange request...
Basically I have added the font mushin (free japanese font) into my Shopify theme (using sense) no problem, but I am wanting to add what is called "furigana" above the text It's essentially adding pronunciation for english speakers above the japanese character.
It's obviously a different font from mushin. I think it would somehow work by adding the two fonts simultaneously into the heading...but no idea how that would work.
Does anyone have any ideas?

Here is an image example of my mock up: https://ibb.co/3Cg6xMV

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgbtyr09zn3llrrszzk1.png)
Data Science for Beginners: 2023-2024 Complete Road-map
Published: 2023-09-29 21:58:04

Data scientists work to deeply understand and analyze data to provide actionable insights. They develop strategies to capture, gather and clean data from a range of sources after which they explore these data to build solutions and communicate their findings.

For the intellectually curious with analytical mindsets who love working with data, I’ll share with you these few simple steps on how to become a data scientist:

1. Have an educational background in mathematics, statistics, and computer science with a solid understanding in concepts like probability, linear algebra and calculus to perform data analysis effectively.

2. Develop proficiency in programming languages like Python and R, which are widely used in data science for data manipulation and analysis.

3. Master data manipulation and cleaning techniques, as data quality is crucial using SQL. Learn how to use tools like Pandas for data preprocessing.

4. Gain expertise in machine learning algorithms, both supervised and unsupervised. Learn how to implement models, tune them, and evaluate their performance.

5. Develop data visualization skills using libraries like Matplotlib to present findings effectively. Power BI and Tableau can also be learned for data visualization.

6. Familiarize yourself with big data tools like Hadoop and Spark for handling large datasets efficiently.

7. Work on personal projects and build a portfolio showcasing your data science skills. Participate or contribute to open-source projects to gain practical experience.

Summarily, data science requires three basic skills which are mathematical, programming and communication skills with a high level of curiosity. 
With data science as a rapidly evolving field, continuous learning and staying updated with industry trends are essential as well. Networking with professionals can also help you on your journey to becoming a data scientist.
Data Science for Beginners: 2023–2024 Complete Roadmap
Tags: datascience, python, programming, beginners
Published: 2023-09-29 21:57:37

In the field of computer science, data science has been popular for many years. Recently, Data science programmes are being offered by many universities.

The need for data science and big data specialists is increasing dramatically as more data is being generated by vibrant services and applications. The field of data science has emerged as a fantastic career choice for software developers and data nerds.

**

## What is data science?
**
Data science has an intersection with artificial intelligence but is not a subset of artificial intelligence.

Data science is the study of an aroused curiosity in any given field, the extraction of data from a large source of data related to the question in mind, processing data, analyzing and visualizing this data, so as to make meaning out of it for IT and business strategies.

In simple terms, it is understanding and making sense of data. A lot of tools are used in data science. They include statistical tools, probabilistic tools, linear and metric algebra, numerical optimization and programming.

**Career paths in data science.**
One of the lucrative and in-demand professions for qualified experts is data science. Although a job in data science is fulfilling and lucrative, getting started is not that easy. It is not necessary to have a master’s or bachelor’s degree to work in data science. One requires the proper skill set and expertise. Below are examples of career choices in the field of data science:

- Data Analyst
- Data Scientist
- Data Engineer
- Machine Learning Engineer
- NLP Engineer
- Business Analyst
- Power BI engineer

## Steps involved in developing a suitable machine learning model
_Data collection_: This is basically find a suitable dataset to work on, you can either import a csv, excel or a json file.
_Data Preparation_: Putting together all the data you have and randomizing it, Cleaning the data to remove unwanted data, missing values, rows, and columns, duplicate values, data type conversion, Visualize the data to understand how it is structured and understand the relationship between various variables and finally Splitting the cleaned data into two sets - a training set and a testing set.
_Choose suitable model_: Depending on the type of data you’re working with to solve a regression or a classification problem. Can be linear or logistic regression, SVM, XGBoost, LSTM , BiLSTM , Random Forest and so on.
_Training the model_: you pass the prepared data to your machine learning model to find patterns and make predictions.
_Model Evaluation_: After training your model, you have to check to see how it’s performing. This is done by testing the performance of the model on previously unseen data.
_Parameter Tuning_: Adjusting to see how best to improve the accuracy of the model.
_Make Predictions_: In the end, you can use your model on unseen data to make predictions accurately.
How to dynamically serialize model fields in Django REST Framework
Tags: webdev, django, python, programming
Published: 2023-09-29 21:42:42

So, how about a scenario that we define our serializer class to access all fields in the model, but we choose which fields to be serialized when we instantiate the serializer class?

Know more reading the full article [here](https://uhtred.dev/insights/how-to-dynamically-serialize-model-fields-in-django-rest-framework)!
# My First Week with Lux_Dev
Tags: luxdatanerds, dseafrica, luxdev
Published: 2023-09-29 21:40:28

## Week 1 with Lux_Dev

- As a 9-month data science newbie, this week was a great reintroduction to the future of my journey: potential paths, steps to take, and fine-tuning basics.
- We discussed key data science concepts, career paths, statistical/mathematical/programming fundamentals, Python/SQL for data manipulation/wrangling/analysis, data science fundamentals (stats, probability, linear algebra, calculus, Python, SQL), and data visualization tools (Matplotlib, Seaborn).
- I'm excited for the rest of the weeks ahead! 🎉
Hacktoberfest 2023 Pledge
Tags: hacktoberfest23
Published: 2023-09-29 21:30:54

### Intro
I've been participating in Hacktoberfest, as both contributor and maintainer, for 3 years. I'm a computer science professor, and I've been open sourcing much of my research code recently. I also maintain several projects completely unrelated to my research, various utilities, etc, including several GitHub Actions.

I haven't blogged at all about my research. But I do post here on DEV about the GitHub Actions and other utilities that I maintain, and occasionally posts with tips on using GitHub Actions, and other random things.

I'm also a tag moderator for the [Java](https://dev.to/t/java) and [showdev](https://dev.to/t/showdev) tags, as well as a DEV trusted member.  

### Pledge
I'm not totally sure about how this whole pledge thing is supposed to work since it is a new part of Hacktoberfest, but here goes....

On participating as a contributor.... Since I'm on GitHub several times a week anyway, it's a bit hard to distinguish what is really different in the month of October relative to the rest of the year. Within my own repositories, I will likely use Hacktoberfest to get to things I've been putting off doing. For those new to Hacktoberfest, yes contributions in your own repositories count. But I will also seek out at least one project of someone else's to help.

On participating as a maintainer.... I've opted in one of my repositories, welcoming Hacktoberfest contributions, the same repository as last year. I've chosen this one because it is relatively easy for first time contributors, and has several open issues. I've opted in only one repository because Hacktoberfest tends to significantly increase contributors relative to the rest of the year, and I want to make sure I can respond to PRs in a timely manner. 

I'm going to post in more detail within the next day or two about the open issues, etc, but here's the repository:

{% github cicirello/user-statistician %}
gnu-on-alpine 3.18.4 and alpine-plus-plus 3.18.4 Released
Tags: docker, linux, github, showdev
Published: 2023-09-29 21:03:53

## TL;DR

I just released [gnu-on-alpine](https://github.com/cicirello/gnu-on-alpine) 3.18.4 and [alpine-plus-plus](https://github.com/cicirello/alpine-plus-plus) 3.18.4, [two lightweight containers for implementing GitHub Container Actions with shell scripting](https://dev.to/cicirello/gnu-on-alpine-and-alpine-plus-plus-two-lightweight-containers-for-implementing-github-container-actions-with-shell-scripting-360i). Both containers are built upon [alpine](https://hub.docker.com/_/alpine) to keep the image size small for fast loading within GitHub Actions, and both are preinstalled with bash, coreutils, findutils, and gawk; and alpine-plus-plus is additionally preinstalled with git.


## Changelog gnu-on-alpine 3.18.4 - 2023-09-29

### Changed
* Bumped alpine to 3.18.4.

## Changelog alpine-plus-plus 3.18.4 - 2023-09-29

### Changed
* Bumped alpine to 3.18.4.


## More Information

For more information, see my earlier post about gnu-on-alpine and alpine-plus-plus here on DEV, as well as their GitHub repositories and project pages. Please consider starring on GitHub.

{% link https://dev.to/cicirello/gnu-on-alpine-and-alpine-plus-plus-two-lightweight-containers-for-implementing-github-container-actions-with-shell-scripting-360i %}

{% github cicirello/alpine-plus-plus %}

{% github cicirello/gnu-on-alpine %}

{% embed https://actions.cicirello.org/alpine-plus-plus/ %}

{% embed https://actions.cicirello.org/gnu-on-alpine/ %}


## Where You Can Find Me

Follow me [here on DEV](https://dev.to/cicirello) and on [GitHub](https://github.com/cicirello):

{% user cicirello %}

Or visit my website:

{% embed https://www.cicirello.org/ %}
10 Proven Ways to Supercharge Your Online Income and Achieve Financial Freedom"
Published: 2023-09-29 20:51:46

In today's digital age, more and more people are exploring opportunities to earn money online. Whether you're looking for a side hustle or dreaming of replacing your traditional job, the internet provides a vast array of possibilities. However, with countless options available, it can be overwhelming to figure out the most effective strategies to boost your online income.

That's why we're here to help! In this blog post, we will unveil 10 proven ways to take your online income to new heights. These strategies have been tried and tested by successful entrepreneurs and have the potential to transform your financial situation. Whether you're a freelancer, an aspiring digital marketer, or an e-commerce enthusiast, you'll find valuable insights and practical tips to maximize your earning potential.

So, grab a cup of coffee and get ready to embark on a journey towards financial freedom. Let's dive into these 10 game-changing methods that will help you skyrocket your online income and unlock a world of limitless possibilities.

[check it out here]https://givevaluefirst.com/john-crestani-journey-from-struggles-to-success/