All Projects → alfredosalzillo → react-pendulum

alfredosalzillo / react-pendulum

Licence: other
A React Context utility library.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to react-pendulum

C Utils
Tiny, modular, drop-in, library of some most commonly used utility methods for C (embedded) applications. Intended to be used as a git-submodule inside your projects to kickstart development. See https://c-utils.gotomain.io for more details.
Stars: ✭ 47 (+213.33%)
Mutual labels:  utility, utility-library
fastnumbers
Super-fast and clean conversions to numbers.
Stars: ✭ 85 (+466.67%)
Mutual labels:  utility, utility-library
mpu
Martins Python Utilities - Stuff that comes in Handy
Stars: ✭ 47 (+213.33%)
Mutual labels:  utility, utility-library
go-tools
A utility tool library of Golang.
Stars: ✭ 44 (+193.33%)
Mutual labels:  utility, utility-library
Fakeit
The Kotlin fake data generator library!
Stars: ✭ 482 (+3113.33%)
Mutual labels:  utility, utility-library
Lodash Php
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP
Stars: ✭ 412 (+2646.67%)
Mutual labels:  utility, utility-library
Infinite-File-Curtailer
Curtail is a utility program that reads stdin and writes to a file bound by size.
Stars: ✭ 23 (+53.33%)
Mutual labels:  utility, utility-library
Utils
A collection of useful PHP functions, mini classes and snippets that you need and can use every day.
Stars: ✭ 750 (+4900%)
Mutual labels:  utility, utility-library
Bbo
bbo is a utility library of zero dependencies for javascript. 🍖🌭🍔
Stars: ✭ 227 (+1413.33%)
Mutual labels:  utility, utility-library
Laravel Zero
A PHP framework for console artisans
Stars: ✭ 2,821 (+18706.67%)
Mutual labels:  utility
dpytools
Collection of easy to use, beginner friendly but powerful, orthogonal tools to speed up discord bots development (discord.py)
Stars: ✭ 23 (+53.33%)
Mutual labels:  utility-library
Dot Github
.github directory generator
Stars: ✭ 237 (+1480%)
Mutual labels:  utility
Musoq
Use SQL on various data sources
Stars: ✭ 252 (+1580%)
Mutual labels:  utility
WinDev-Utility
A utility for windows developers
Stars: ✭ 17 (+13.33%)
Mutual labels:  utility
Ethereum Input Data Decoder
Ethereum smart contract transaction input data decoder
Stars: ✭ 242 (+1513.33%)
Mutual labels:  utility
apint
Arbitrary precision integers library.
Stars: ✭ 23 (+53.33%)
Mutual labels:  utility
Proximityhash
Geohashes in proximity
Stars: ✭ 231 (+1440%)
Mutual labels:  utility
Relude
FP-inspired prelude/standard library for ReasonML projects
Stars: ✭ 230 (+1433.33%)
Mutual labels:  utility
GPUUtilization
measure GPU hardware utilization on iOS Devices
Stars: ✭ 102 (+580%)
Mutual labels:  utility
toastify
🍞A commandline tool that shows desktop notifications using notify-rust
Stars: ✭ 60 (+300%)
Mutual labels:  utility

react-pendulum

A React Context utility library.

NPM JavaScript Style Guide codecov

Install

Using npm

npm install --save react-pendulum

Using yarn

yarn add react-pendulum

Components

MultiProvider

A component to clean up the nasty code you get from taking advantage of React Context API.

Props

  • providers the array of providers instances to wrap to the children
import React, { Component, createContext } from 'react'
import { MultiProvider } from 'react-pendulum'

const FirstNameContext = createContext<string>('John')
const LastNameContext = createContext<string>('Doe')

const HelloWorld = () => {
  const firstName = useContext(FirstNameContext)
  const lastName = useContext(LastNameContext)
  return <>{`Hello ${firstName} ${lastName}`}</>
}

class App extends Component {
  render() {
    return (
      <MultiProvider
        providers={[
          <FirstNameContext.Provider value='Yugi' />,
          <LastNameContext.Provider value='Muto' />
        ]}
      >
      <HelloWorld />
    </MultiProvider>
    )
  }
}

Utilities

withContext

A high order function to create the withContext HOC for any Context.

Args:

  • Context the context to assign the value
  • propsName the props name to assign the value of Context
import React, { Component, createContext } from 'react'
import { withContext } from 'react-pendulum'

const NameContext = createContext<string>('John Doe')

const withName = withContext(NameContext, 'name');
const HelloWorld = withName(({ name }) => {
  return <>{`Hello ${name}`}</>
})

License

MIT ©

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].