Home > Web Front-end > JS Tutorial > My React Journey Day1

My React Journey Day1

Patricia Arquette
Release: 2024-11-30 11:21:18
Original
920 people have browsed it

My React Journey Day1

I am super excited to kick off my journey in React Native! Building mobile apps has always been a dream of mine, and today, I took the first step towards making it a reality.

My focus today was on Variables (var, let, const) and Data Types (strings, numbers, arrays, booleans, and objects). Here's what I learned:

Variables (VAR, LET, CONST)
Understanding the differences between these three was eye-opening:

var: Can be reassigned and redeclared. It has function scope, which makes it more exposed and less secure in modern coding practices.
let: Can be reassigned but not redeclared. It uses block scope, making it safer and more preferred than var.
const: Cannot be reassigned or redeclared. Like let, it has block scope. It's perfect for values that should remain constant.

One takeaway: if a value shouldn't change, always use const. It ensures your code stays clean and predictable.

Data Types
Here's a quick breakdown of the data types I explored today:

Strings: A string is any text enclosed in either double quotes (" ") or single quotes (' '). For example, "Hello, world!" is a string.
Numbers: Any numeric value from 0 - 9, like 42 or 3.14, belongs to the number type.
Arrays: Think of an array as a collection of values stored in a single variable. For example, [1, 2, 3] or ['apple', 'banana', 'cherry'].
Booleans: This data type has only two possible values: true or false. It’s great for decision-making in code.
Objects: Objects are collections of related data in key-value pairs. For instance:

const person = {
  name: 'Jane',
  age: 25,
  greet: function () {
    return 'Hello!';
  }
};
Copy after login

Objects can even include methods (functions) that belong to the object itself!

Final Thoughts
Overall, today was a beautiful learning ride. I feel more confident about the basics and can't wait to dive deeper tomorrow.

If you're also starting out or looking for a reason to learn React Native, why not join me on this daily challenge/ride? Let's build something amazing together!

Stay tuned for Day 2!

The above is the detailed content of My React Journey Day1. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template