
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
ax-react-lib
Advanced tools
Some useful staffs for react development.
The component for manage app state.
reducers: An object that take reducer for different key.
defaultValues: An object that assign defaultValue to different key.
children: ReactNode.
function App(){
return (
<Store
reducers={{
'counter': (state, action)=>{
switch(action.type){
case 'increment':
return state+1;
case 'reset':
return 0;
case 'set':
return action.counter;
default:
return state;
}
}
}}
defaultValues={{
'counter':0,
'counter2':0
}}
>
<Children/>
</Store>
)
function Children(){
const [counter,setCounter]=useStore('counter');
const [counter2,setCounter2]=useStore('counter2');
const [counter3,setCounter3]=useStore('counter3',0);
return (
<div>
<button onClick={()=>setCounter({type:'increment'})}>counter</button>
<button onClick={()=>setCounter(counter2+1)}>counter2</button>
<button onClick={()=>setCounter(counter+counter2)}>counter3</button>
</div>
)
}
}
A component that render it's children when condition is meet.
condition: A boolean value or a function that returns a boolean value.
children: ReactNode. Children will be render when the condition is true.
function App(){
return (
<Store>
<Children/>
</Store>
)
function Children(){
const [isLogin,setLogin]=useStore('login');
return (
<div>
<If condition={isLogin}>
<Contents></Contents>
</If>
<If condition={!isLogin}>
<Login/>
</If>
</div>
)
}
}
A component will run a function.
load: a function for loading things.
callback: Optional, a function for handle result of load.
function App(){
return (
<Store>
<Children/>
</Store>
)
function Children(){
const [isLogin,setLogin]=useStore('login');
return (
<div>
<Loader
load={async ()=>{
const res = await login();
return res;
}}
callback={(res)=>{
setLogin(res)
}}
/>
<If condition={isLogin}>
<Contents></Contents>
</If>
<If condition={!isLogin}>
<Login/>
</If>
</div>
)
}
}
A component will render its children when it's visible.
tag: HTML tag name or React component name, Default: div
children: ReactNode
style: CSS properties
className:CSS class name
root:The element that is used as the viewport for checking visibility of the target.
threshold: Either a single number or an array of numbers which indicate at what percentage of the target's visibility the observer's callback should be executed. Default: 0
rootMargin: Margin around the root.
forward: boolean. If set to true, the observer will be removed once the element is visible. Default: true
function App(){
return (
<div>
...React Nodes
<LazyLoad tag='div'>
...React Nodes
</LazyLoad>
</div>
)
}
Access Store data.
key: a string key for access data.
defaultValue: The default value when no data in the store for the key.
[data:any, update:(value|Action)=>void]
data:The value of the key in the store.
update: A function to update the value of the key. It take an action when there is a reducer assigned to the key or take any value when not reducer is assigned.
function App(){
return (
<Store
reducers={{
'counter': (state, action)=>{
switch(action.type){
case 'increment':
return state+1;
case 'reset':
return 0;
case 'set':
return action.counter;
default:
return state;
}
}
}}
defaultValues={{
'counter':0,
'counter2':0
}}
>
<Children/>
</Store>
)
function Children(){
const [counter,setCounter]=useStore('counter');
const [counter2,setCounter2]=useStore('counter2');
const [counter3,setCounter3]=useStore('counter3',0);
return (
<div>
<button onClick={()=>setCounter({type:'increment'})}>counter</button>
<button onClick={()=>setCounter(counter2+1)}>counter2</button>
<button onClick={()=>setCounter(counter+counter2)}>counter3</button>
</div>
)
}
}
Use useAsync when an async operation is needed.
fn: an async function.
DependencyList : React DependencyList.
[isDone:boolean, reset:()=>void]
isDone: The status of current async operation, return true when operation is finished.
reset: A function can restart the async operation.
function SomeComponent(){
const [data,setData] = useState();
const [isDone,reset] = useAsync(async ()=>{
const res = await fetch('data');
const data = await res.json();
setData(data)
});
return (
<button onClick={reset}>{'Refresh'}</button>
)
}
useEffect with delay.
fn: an function.
dep : React DependencyList.
ref: A ref to Element .
options: IntersectionObserverInit.
forward:If set to true, the observer will be removed once the element is visible. Default: true
isIntersecting: A boolean value. Return true if the element is intersecting.
FAQs
Some useful staffs for react development.
The npm package ax-react-lib receives a total of 13 weekly downloads. As such, ax-react-lib popularity was classified as not popular.
We found that ax-react-lib 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.