Git Product home page Git Product logo

mywebpage's Introduction

Repositório criado para o Live Coding de 04/01/21 da Digital Innovation One

Configuração de Ambiente

  • Instalação do node e yarn
  • Instalação de uma IDE caso não tiver
  • Instalação do React
npm create react-app primeiro-projeto-react --template=typescript
cd primeiro-projeto-react
yarn start

Organizar a estrutura do projeto

  • Crie os componentes do nosso projeto: Profile e Repository

  • Instalar o react-route-dom para a configuração das rotas do projeto

yarn add react-router-dom -D
criar a pasta routes

Criar Rotas

- Criar routes.tsx - Criar as páginas da aplicação e colocar a constante do Function Component React.FC - Para a definição das rotas - Instale o @types do react-router-dom
yarn add @types/react-router-dom
  • Crie as duas rotas da nossa aplicação
import React from "react";
import { Route, Switch } from "react-router-dom";

import Profile from "../pages/profile";
import Repository from "../pages/repository";

const Routes: React.FC = () => (
  <Switch>
    <Route path="/" exact component={Profile} />;
    <Route path="/repository" component={Repository} />;
  </Switch>
);

export default Routes;
  • Organizar o App.tsx
import React from "react";
import Routes from "./routes";

import { BrowserRouter } from "react-router-dom";

const App: React.FC = () => (
  <BrowserRouter>
    <Routes />
  </BrowserRouter>
);

export default App;

Adicione a biblioteca para estilizar o seu site

yarn add styled-components -D
yarn add react-icons -D                                                 
  • Criar as páginas da aplicação

  • Criar o useEffect
interface Repository {
  full_name: string;
  description: string;
  html_url: string;
  stargazers_count: number;
  forks_count: number;
  open_issues_count: number;
}

const Repository: React.FC = () => {

const [repositories, setRepositories] = useState<Repository[]>([]);

  useEffect(() => {
    api.get(`/users/bahcasac/repos`).then((response) => {
      setRepositories(response.data);
    });
  }, []);
}

mywebpage's People

Contributors

bahokubo avatar

Stargazers

Luiz Oliveira avatar

Watchers

 avatar  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.