
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
@lsky/http-react
Advanced tools
<HttpProvider />$ npm install @lsky/http-react --save
$ yarn add @lsky/http-react
$ yarn add react axios
import React from 'react'
import HttpReact, { Post, Get, HttpProvider } from '@lsky/http-react'
class Index extends React.Component {
render() {
return (
<div>
<HttpReact
url="/test/test"
data={{ param: 'abc' }}
method="post"
onResponse={(response) => { console.log('response: ', response) }}
onError={(error) => console.log('error: ', error)}
onLoading={(loading) => console.log('isLoading: ', loading)}
>
http react
</HttpReact>
<Post
url="/test/test"
data={{ param: 'abc' }}
onResponse={(response) => { console.log('post: ', response) }}
>
post http react
</Post>
<Get
url="/test/test"
params={{ param: 'abc' }}
onResponse={(response) => { console.log('get: ', response) }}
>
post http react
</Get>
<HttpProvider baseURL={"http://localhost:3000"}>
<Post
url="/test/test"
data={{ path: '/test/test' }}
onResponse={(response) => { console.log('post: ', response) }}
>
post http react
</Post>
</HttpProvider>
<Get
url={get.url}
onResponse={(response) => { console.log('get: ', response) }}
loading={<div>loading...</div>}
/>
</div>
)
}
}
import React from 'react'
import { WebSocket } from '@lsky/http-react'
const sendMsg = (socket) => {
socket.send('message test')
}
const onMessage = (messageEvent) => {
console.log('message: ', messageEvent)
}
class Index extends React.PureComponent {
render() {
return (
<WebSocket
url="ws://localhost:4000"
onMessage={onMessage}
>
{({ socket }) => <div><button onClick={() => sendMsg(socket)}>send msg</button></div>}
</WebSocket>
)
}
}
| attr | type | default value | desc |
|---|---|---|---|
| method | string | null | http method |
| url | string | null | url |
| debounce | number | 500 | debounce |
| data | string | plain object | URLSearchParams | null | data is the data to be sent as the request body; Only applicable for request methods 'PUT', 'POST', and 'PATCH' |
| params | plain object | null | params are the URL parameters to be sent with the request |
| children | React.ReactChild | null | react node |
| loading | React.ReactNode | boolean | null | show in loading |
| onResponse | (response) => void | null | onResponse |
| onError | (error) => void | null | onError |
| onLoading | (isLoading: boolean) => void | null | onLoading |
| attr | type | default value | desc |
|---|---|---|---|
| url | string | null | url |
| debounce | number | 500 | debounce |
| params | plain object | null | params are the URL parameters to be sent with the request |
| children | React.ReactChild | null | react node |
| loading | React.ReactNode | boolean | null | show in loading |
| onResponse | (response) => void | null | onResponse |
| onError | (error) => void | null | onError |
| onLoading | (isLoading: boolean) => void | null | onLoading |
| attr | type | default value | desc |
|---|---|---|---|
| url | string | null | url |
| debounce | number | 500 | debounce |
| data | string | plain object | URLSearchParams | null | data is the data to be sent as the request body; Only applicable for request methods 'PUT', 'POST', and 'PATCH' |
| params | plain object | null | params are the URL parameters to be sent with the request |
| children | React.ReactChild | null | react node |
| loading | React.ReactNode | boolean | null | show in loading |
| onResponse | (response) => void | null | onResponse |
| onError | (error) => void | null | onError |
| onLoading | (isLoading: boolean) => void | null | onLoading |
| attr | type | default value | desc |
|---|---|---|---|
| url | string | null | websocket url |
| timeout | number | 1000 | restart time |
| max | number | 10 | restart count |
| children | React.ReactNode | ({socket}) => React.ReactNode | null | react node |
| onOpen | (event) => void | null | socket open callback |
| onMessage | (messageEvent) => void | null | recieve message callback |
| onClose | (closeEvent) => void | null | socket close callback |
| onError | (event) => void | null | socket error callback |
FAQs
Unknown package
We found that @lsky/http-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.