Skip to content

monkey192/reactjs-entry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Create React App

Util scripts

  • create project
    npx create-react-app my-app
    with typescript template
    npx create-react-app my-app --template typescript
  • start
    cd <project directory>
    npm run start
  • build project

How to create a react component

  • Functional Components (Pure function)
    const Democomponent=()=>
    {
        return <h1>Welcome Message!</h1>;
    }
  • Class Components
    class Democomponent extends React.Component
        {
            constructor(props) {
                super(props);
                this.state = {count: 1};
            }
            render(){
                return <h1>Welcome Message!</h1>;
            }
        }
  • Diff and should choose Functional or Class component Refer it for brief comparation.

How to sharing data between component

Refer: https://www.pluralsight.com/guides/react-communicating-between-components

  • From parent to child with props
  • From child to parent with callbacks it is as same as EventEmit in angular
  • From parent tof child with context
  • Sideways with non-react options

Styles

Hook

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages