2.4.0 • Published 12 months ago

@madfi/widgets-react v2.4.0

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

Lens Widgets React library

Dependencies

These packages must be installed in the root React app

  • react
  • react-dom
  • tailwindcss
  • @tanstack/react-query@^4.22.0

With @tanstack/react-query you have to follow their setup docs - and if using Next.js check this github issue for webpack setup

Installation

yarn install @madfi/widgets-react

With Next.js

If you are using Next.js pages directory please update your next.config.js with the following:

transpilePackages: ['@madfi/widgets-react'],

So the final configuration might look like this:

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  transpilePackages: ['@madfi/widgets-react']
}
module.exports = nextConfig

Once this update is made, please re-run the server:

yarn watch:ts

Local Development

  1. Install deps
nvm use
pnpm install
  1. Create a symlink in this directory
yarn link
  1. Build the app in watch mode
yarn watch:ts
  1. Install in your project + use the symlink
yarn install @madfi/widgets-react
yarn link "@madfi/widgets-react"

With Next.js Dynamic Imports

Another option when working with Next.js pages directory apps is using a Dynamic Import:

/* Profile created in separate component */
import {
  Profile
} from '@madfi/widgets-react'

export default function ProfileComponent() {
  return (
    <Profile handle='lens/madfinance' />
  )
}

/* ProfileComponent imported using a dynamic import */
import dynamic from 'next/dynamic'
const ProfileComponent = dynamic(() => import('../components/ProfileComponent'), { ssr: false })

export default () => {
  return (
    <div>
      <ProfileComponent />
    </div>
  )
}
2.3.0

12 months ago

2.4.0

12 months ago

2.3.1

12 months ago

2.2.5

1 year ago

2.2.4

1 year ago

2.2.7

1 year ago

2.2.6

1 year ago

2.2.8

1 year ago

2.2.3

1 year ago

2.2.2

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.1.31

1 year ago

2.1.30

1 year ago

2.1.29

1 year ago

2.1.28

1 year ago

2.1.27

1 year ago

2.1.25

1 year ago

2.1.26

1 year ago

2.1.24

1 year ago

2.1.23

1 year ago

2.1.22

1 year ago

2.1.21

1 year ago

2.1.20

1 year ago

2.1.18

1 year ago

2.1.19

1 year ago

2.1.16

1 year ago

2.1.17

1 year ago

2.1.14

1 year ago

2.1.15

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.10

1 year ago

2.1.9

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

2 years ago

2.1.0

2 years ago