Socket
Book a DemoInstallSign in
Socket

pollinations-react

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pollinations-react

React components and hooks for Pollinations AI

latest
npmnpm
Version
1.1.9
Version published
Maintainers
0
Created
Source

pollinations-react

A simple React package for generating images using Pollinations' API.

Installation

npm install pollinations-react

Usage

Hook

The usePollinationsImage hook allows you to generate images using Pollinations' API and use them in your React components.

import React from 'react';
import { usePollinationsImage } from 'pollinations-react';

const MyComponent = () => {
  const imageUrl = usePollinationsImage('A beautiful sunset over the ocean');
  
  return (
    <div>
      {imageUrl ? <img src={imageUrl} alt="Generated" /> : <p>Loading...</p>}
    </div>
  );
};

export default MyComponent;

Component

The PollinationsImage component simplifies the process of generating and displaying images using Pollinations' API.

import React from 'react';
import { PollinationsImage } from 'pollinations-react';

const MyComponent = () => (
  <PollinationsImage prompt="A beautiful sunset over the ocean" />
);

export default MyComponent;

Development

Local Development

To develop this package locally, follow these steps:

  • Clone the repository:
git clone https://github.com/your-username/pollinations-react.git
cd pollinations-react
  • Install dependencies:
npm install
  • Start the development server:
npm run dev

Publishing

To publish the package to npm, run:

npm publish --access public

License

This project is licensed under the MIT License. See the LICENSE file for details.

Made with ❤️ by the Pollinations.AI team

FAQs

Package last updated on 12 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.