npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cra-template-khipo

v0.0.5

Published

## Stack principal * React v17 - Versão atual com diversas novas features * TypeScript - JavaScript com tipagem * Styled Components - Componentização de estilos CSS * Redux Toolkit - Gerenciamento de estados * ESlint - Linter de JavaScript e TypeScript *

Downloads

13

Readme

Khipo CRA Template

Stack principal

  • React v17 - Versão atual com diversas novas features
  • TypeScript - JavaScript com tipagem
  • Styled Components - Componentização de estilos CSS
  • Redux Toolkit - Gerenciamento de estados
  • ESlint - Linter de JavaScript e TypeScript
  • Prettier - Formatador de código e espaçamentos
  • Jest e Enzyme - Testes. Interessante utilizar

Mais informações abaixo

Opcionais Interessantes

  • React Bootstrap - Biblioteca de UI
  • Moment - Gerenciamento de data e horáriojuntos
  • React-snap - Otimização de Loading
  • Material UI ou Bulma - Bilioteca de componentes

TypeScript

Traz tipagem e outras novas features para o JavaScript. Junto a um linter é possível encontrar erros no código sem nem mesmo rodar. Ajuda muito na organização do código e reutilização de funçoes, componentes e interfaces. Muito difundido em projetos de empresas grandes e muito bem aceito pela comunidade.

\\ Type Check
const obj = { width: 10, height: 15 };
const area = obj.width * obj.heigth;
Property 'heigth' does not exist on type '{ width: number; height: number; }'. Did you mean 'height'?


\\ Interfaces
interface User { \\ Define os campos do objeto
  name: string;
  id: number;
  gender: 'male' | 'female' | 'other'; \\ Não permite outros valores
}

function createUser(user: User) { \\ Só permite a entrada de um objeto user
  ....
}

function whatever(obj: any) { \\ Permite a entrada de qualquer tipo de argumento
  ....
}

Styled Components

Traz a componentização para os estilos de CSS. Deixa o código muito mais legível e reaproveitavel. Fica mais fácil componentizar tudo que possa ser usado mais de uma vez

\\ Sem Styled Components
<div className="container">
  <h1 className="title">
    Meu Título
  </h1>
</div>


\\ Com Styled Components
const Container = styled.section`
  padding: 4em;
  background: papayawhip;
`;
const Title = styled.h1`
  font-size: 1.5em;
  text-align: center;
  color: palevioletred;
`;

<Container>
    <Title>
      Meu Título
    </Title>
</Container>

Context

É o gerenciador de estados que vem com o React. Mais leve que o Redux e geralmente muito rápido. Para a maior parte dos projetos pode fazer mais sentido utilizá-lo ao invés de Redux para diminuir o tamanho do Bundle. https://dook.pro/blog/technology/39-redux-vs-react-context-which-one-is-the-right-winner & https://reactjs.org/docs/context.html#when-to-use-context

const AuthContext = createContext({});
async function Login() {
   const response = await api.post('/login', {
     email: '[email protected]',
     password: '123456',
   });

   console.log(response);
 }


<AuthContext.Provider value={{signed: true, Login}}>
   <Main />
</AuthContext.Provider>


\\ Dentro da Main
...
function handleLogin() {
   context.Login();
}
...