Code Monkey home page Code Monkey logo

tasktracker's Introduction

taskTracker

Hi,:wave: this is my first React project, I chose to build a task tracker to learn all the basics and get a good understanding how Reactjs framework works.
Note: Go to the Build-code branch to get the production code for this project and how to deploy it on your machine.

During this project had the chance to learn all the following about React

Set up my first react development envierment
by running the following command:
npx crear-react-app my-app

How to creat a class Component:

export default class Header extends React.Component{
constructor(props) {
    super(props);
    this.state = {}
}
    render()  {
        return (
            <div>
	<h1> My Header </h1>
            </div>
        )

   }
}

How to creat a function Component:

export const Header = () => {

      const name = ‘reda’

      return (
            <div>
	<h1> Hi {name} </h1>
            </div>
}

Calling a component:


Import Header from ‘./Header’;

 and use:  <Header />

Passing props to components:

< Component name=’reda’ />

setting a propsType:

Component.propTypes = {
name: PropTypes.string
}
{string, number, bool, func, array, object...}

Events:

<Button onClick={buttonClicked} />
<input  type="text"  onChange={e => console.log(e.target.value)} />

useState Hook:

The React useState Hook allows us to track state in a function component.
1 – Import the hook:

import { useState } from "react";

2 - Initialize useState:

const [variabl, setVariable] = useState([one, two, three]);

variable: is the name of our state.
SetVariable: the function we use to update our state.
UseState: the initial state of our state.

UseEffect:

UseEffect( ()=>{ } ) when we want something to happen right after page loads.

Lists & .map(key):

const numbers = [1, 2, 3, 4, 5];
const listItems = numbers.map((number) => <li>{number}</li>);
const users = [{name:’reda’, age:25},{name:’john’, age:28}];
const usersAge = users.map((key) => <p>{key.age}</p>);

React-icons:

1 - install react icons: npm I react-icons
2 - import to file: import {FaTimes} from 'react-icons/fa'
3 – use the icons in code: <FaTimes />

React Build Version:

After finishig the app we can create a statc version.
npm run build (Creat new folder named build with all files)

tasktracker's People

Contributors

reda-codes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.