Lädt...


🔧 Building in Public: My Journey in React Image Layout with Flexbox and Grid - ACT 2: React Basics and Changing Default Port


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

BUILDINGINPUBLIC:
This is a series in which I am sharing openly how I am going about putting up a basic web application. I am sharing the my progress, challenges and insights in real-time. Instead of just showing you the final product. This series is capturing every step, as I dive into the project with React.
The story continues

Link to ACT 1 Here: https://dev.to/voke_vawkei/building-in-public-my-journey-in-react-image-layout-with-flexbox-and-grid-4j5a

EPISODE ONE: react-image-rendering

ACT 2:
ACT 2:PART ONE:

INTRO/RECAP:
In the last ACT, we setup react, by initializing a new project using vite. We went with react. We also ran npm install to install the necessary dependencies. We also got some contents in our react-image-rendering-slack folder, contents like public folder, src folder, .gitignore, index.html, package.json, node_module folder among others. And also got the vite react logo and counter showing in the browser.

ACT 2:PART TWO:
TOUCHING THE BASICS:

Javascript and ReactJs:
Before we delve deep, like real deep. It's best we have an idea of what Javascript and Reactjs is.
Javascript is programming language that is mainly used to create interactive effects within a web browser. It helps to make a web page dynamic. It allows developers like me to add functionality to a web page. Though I am referring to Javascript on the frontend here, it can also be used on the backend too. But that is story for another day.

React, on the other hand, which is also known as Reactjs, is a Javascript library that is used for building user interfaces for the web. It's a clientside library. And by clientside, I mean the part of the web app that a user can see and interact with.

Imagine your favourite web app; Netflix, what was used to build it was React. React is like a lego boxset that we use to build various components in Netflix. Each component is like a lego block, created with React. It also helps us to move around smoothly from one component to another. And by components, I am talking about the nav bar, search bar, movie card, even the "flipping" buttons. Same logic works with Facebook, even Instagram. So what is bringing those darling web apps of yours to life in the palm of your hands is made possible with the capabilities of Javascript.

React-router-dom:
React-router-dom is a third party package used by react library to help us move around from page to page eventhough we are in an SPA. It helps us in defining routes within our app. The react-router gives as the illusion that we are in a multipage application, but in reality, we are not.

Scss:
Scss is a preprocessor syntax for css. I will be using it here instead of css. And css stands for cascading style sheet. It's used for styling a web page, making it beautiful. Css is dope, but Scss is doper. It's best suited for larger projects and helps us write better organized code than Css. Don't worry, in another episode, I will use Css. Scss Can be described as a tool that helps us to write Css with extra features like variables. Once you write 'em the preprocessor converts the code into Css so it can be read by browsers. Scss is Css on steriods.

ACT 2:PART THREE:
Installing Dependencies and Setting the Development Environment

I will break this part into steps.

Step 1:Stopping the Dev Server:
Ok! with that being said, lets run some installations,
we got two options, we can type: ctrl + c in the terminal to close our dev server and then run the installations or we can go down and create a new terminal by clicking on the v on the right side of the + icon. These can be found at the bottom right of the editor. Clicking on the v shows command prompt, git bash, split terminal, powershell etc. But I will go with the former, by typing in the:

ctrl + C 

This stops our dev server

The response after typing ctrl + C is:

 ➜  Local:   httpx://localhost:5173/ _
 ➜  Network: use --host to expose
 ➜  press h + enter to show help
^C^CTerminate batch job (Y/N)?

{i will click Y}

Step 2:Installing react-router-dom and Scss

To install react-router-dom:

 npm install react-router-dom

To install Scss/Sass:

 npm install sass

Step 3: Making changes to the Default Port:
One more thing before I start the development server again, you see this:

Local:   http://localhost:5173/

I aint comfortable with it. That's the port our react app is going to be running on locally by default.
Traditionally,

Local:   http://localhost:3000 

is somewhat preferred, so I am going to change it. To change it, I will go into the root of this project folder and look for vite.config.ts file.

This is the content of the file:

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

// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
});

now add this to it:

server:{
    port:3000
  }

The content of the folder should now look like this:

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

// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
  server:{
    port:3000
  }
})

Step 4: Starting the Dev Server:
Now let's start up the development server.

We do that by typing:

 npm run dev 

right there in the terminal.

Then we (ctrl + click) on:

http://localhost:3000/

This starts our application again in the web browser.

Up Next: ACT 2:PART FOUR:

...

🔧 Building in Public: My Journey in React image Layout with Flexbox and Grid


📈 70.43 Punkte
🔧 Programmierung

🔧 The Difference between Flexbox (flex) and Grid Layout (grid)


📈 50.53 Punkte
🔧 Programmierung

🔧 The Secret Sauce to CSS Positioning and Layout: Flexbox & Grid Basics


📈 49.89 Punkte
🔧 Programmierung

🔧 How to Create a Grid-to-List Layout Toggle using Flexbox and JavaScript


📈 39.94 Punkte
🔧 Programmierung

🔧 CSS Grid vs. Flexbox: Choosing the Right Layout Technique


📈 39.26 Punkte
🔧 Programmierung

🔧 CSS Grid vs. Flexbox: Choosing the Right Layout Technique for Your Project


📈 39.26 Punkte
🔧 Programmierung

🔧 🎲 Criando um Dado com Flexbox e CSS Grid Layout


📈 39.26 Punkte
🔧 Programmierung

🔧 Modern CSS Layout Techniques: Grid vs. Flexbox


📈 39.26 Punkte
🔧 Programmierung

🔧 Which is better: Grid layout vs Flexbox?


📈 39.26 Punkte
🔧 Programmierung

🔧 use-magic-grid: Official React port of the magic-grid library


📈 34.58 Punkte
🔧 Programmierung

🔧 Building a Simple Responsive Layout with Flexbox for Beginners


📈 34.44 Punkte
🔧 Programmierung

🔧 Building a Clean and Flexible Pricing Grid with Flexbox: Lessons from Wes Bos' Course


📈 34.16 Punkte
🔧 Programmierung

🔧 CSS Flexbox and Grid: The Art of Building Responsive Layouts


📈 34.16 Punkte
🔧 Programmierung

🔧 Changing The Layout Game (aka Taking Layout To The Next Level)


📈 33.55 Punkte
🔧 Programmierung

🔧 Changing The Layout Game (aka Taking Layout To The Next Level)


📈 33.55 Punkte
🔧 Programmierung

🔧 Building a Dynamic Text Grid with Flexbox: A lesson from Wes Bos’ Course


📈 33.49 Punkte
🔧 Programmierung

🔧 CSS Grid Handbook – Complete Guide to Grid Containers and Grid Items


📈 32.46 Punkte
🔧 Programmierung

🔧 How To Enhance AG Grid with Avatars: Building a Collaborative Grid with React and Ably


📈 32.01 Punkte
🔧 Programmierung

🔧 Building in Public: My React Journey in Image Layouts – The Drama-Version


📈 30.49 Punkte
🔧 Programmierung

🔧 Building CRUD App with react-form, zod, react data grid, react-query and json-server


📈 30.18 Punkte
🔧 Programmierung

🍏 Red Lines Tools 1.4 - Add on-screen lines, grid, layout, and various image overlays.


📈 28.91 Punkte
🍏 iOS / Mac OS

📰 Layout Engine: Facebook portiert CSS-Flexbox für native Apps


📈 28.67 Punkte
📰 IT Nachrichten

📰 Layout Engine: Facebook portiert CSS-Flexbox für native Apps


📈 28.67 Punkte
📰 IT Nachrichten

🔧 Why CSS Flexbox can solve your layout problems löst🧑‍💻


📈 28.67 Punkte
🔧 Programmierung

🔧 Warum CSS Flexbox Deine Layout-Probleme löst🧑‍💻


📈 28.67 Punkte
🔧 Programmierung

🔧 CSS Flexbox: Creating a Landing Page Layout


📈 28.67 Punkte
🔧 Programmierung

🔧 CSS Flexbox: Creating a Footer Layout


📈 28.67 Punkte
🔧 Programmierung

🔧 Post-Modern CSS (In-Depth on CSS Grid, Flexbox and Other New Properties)


📈 28.39 Punkte
🔧 Programmierung

🔧 How to choose between Flexbox, Float and Grid like a pro


📈 28.39 Punkte
🔧 Programmierung

🔧 The Power of CSS Grid and Flexbox for Modern Web Layouts


📈 28.39 Punkte
🔧 Programmierung

🔧 Comparison of Scrollable Layouts with Flexbox and Grid


📈 28.39 Punkte
🔧 Programmierung

🔧 Responsive Web Design with CSS Grid and Flexbox


📈 28.39 Punkte
🔧 Programmierung

🔧 CSS Layouts - Floats, Flexbox, and Grid


📈 28.39 Punkte
🔧 Programmierung

🔧 Grid and Flexbox


📈 28.39 Punkte
🔧 Programmierung

🔧 Combining Flexbox and Grid for a Personal Website Landing Page


📈 28.39 Punkte
🔧 Programmierung

matomo