New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

api-modal-for-react

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-modal-for-react

> A modal component for displaying API responses in React. This package is part of the OpenClassrooms' Front-End Developer path. It is not meant to be used outside of this context. Once the path is completed, and the project validated, this package won't

latest
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

api-modal-for-react

A modal component for displaying API responses in React. This package is part of the OpenClassrooms' Front-End Developer path. It is not meant to be used outside of this context. Once the path is completed, and the project validated, this package won't be maintained.

NPM JavaScript Style Guide

Install

npm install api-modal-for-react

Usage

import Modal from 'api-modal-module';

const App = () => {

	// Variables for the Modal Node Package
	const [showModal, setShowModal] = useState({ display: 'none' });
	const [apiResponse, setApiResponse] = useState({ status: 418, statusText: "I'm a teapot", data: {} });
	const [redirectPath, setRedirectPath] = useState('/');


  return (
	<div>
		<Modal apiResponse={apiResponse} modal__display={showModal} />
			<div>Modal Content</div>
	  	</Modal>
	</div>
  );
};

Props

| Prop Name        | Type   | Description                                        |
| ---------------- | ------ | -------------------------------------------------- | ----------------------------------------------------------- |
| apiResponse      | object | The response from the API call.                    | e.g.: { status: 418, statusText: "I'm a teapot", data: {} } |
| modal\display    | object | The display property for the modal.                | e.g.: { display: 'flex'/'none' },                           |
| redirectPath     | string | The path to redirect to after the modal is closed. | e.g.: '/'                                                   |

License

MIT © Anoerak

FAQs

Package last updated on 22 May 2023

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