Coder Social home page Coder Social logo

yasir5247 / if-component Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kanzitelli/if-component

0.0 0.0 0.0 127 KB

๐Ÿค The tiniest missing component for React (Native). Can be used as a TS starter for building components and libraries.

Home Page: https://www.npmjs.com/package/@kanzitelli/if-component

JavaScript 39.53% TypeScript 60.47%

if-component's Introduction

Install it

yarn add @kanzitelli/if-component

Use it

import {If} from '@kanzitelli/if-component';

class OrdersScreen = () => {
  return (
    <>
      <If _={loading}
      _then={<LoadingIndicator />}
      _else={<SomethingElse />} />
    </>
  )
}

Expo Web

Since if-component uses Reanimated 2, we need its babel plugin to be applied. Expo Web doesn't transpile modules by default, so we'll need to tell it to transpile the library.

  1. Install @expo/webpack-config:
yarn add -D @expo/webpack-config
  1. Create webpack.config.js in the root of your project:
const createExpoWebpackConfigAsync = require('@expo/webpack-config')

module.exports = async function (env, argv) {
  const config = await createExpoWebpackConfigAsync(
    {
      ...env,
      babel: { dangerouslyAddModulePathsToTranspile: ['@kanzitelli/if-component'] },
    },
    argv
  )

  return config
}

Don't forget to add webpack.config.js into tsconfig.json under exclude section, if needed.

TS lib starter

> git clone https://github.com/kanzitelli/if-component rn-lib
> cd rn-lib && rm -rf .git
> yarn

Don't forget to change your lib's name in package.json and check other scripts.

if-component's People

Contributors

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