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

hyperwrap

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperwrap - npm Package Compare versions

Comparing version
1.0.10
to
1.0.11
+1
-1
package.json
{
"name": "hyperwrap",
"version": "1.0.10",
"version": "1.0.11",
"description": "Makes React simple and functional",

@@ -5,0 +5,0 @@ "main": "index.tsx",

+14
-11

@@ -93,15 +93,11 @@ # Meet hyperwrap

- We've moved `changeThing` to it's own module
- We've made `state` and `actions` as optional props to our functional component.
- We've made `state` and `actions` optional props to our functional component.
- We've set default values for `state` and `actions`.
_This lets us to inject mock values for state and actions, for easier testing + now it's a pure function_
Our component is now a pure function. It relies entirely on what is passed into it.
It doesn't create any direct side effects.
This means we can inject mock values for state and actions, for easier testing.
```javascript
import * as React from 'react';
import { State } from '../../../state/state';
import { getState } from 'hyperwrap';
import { changeThing } from './change-thing.function';
interface Props {

@@ -116,7 +112,14 @@ state?: State;

export const Home = ({state, actions}: Props = { state: getState(), actions: actionsCollection } ) => {
export const Home = (
{state, actions}: Props = {
state: getState(),
actions: actionsCollection
}
) => {
const _state = state || getState();
const _actions = actions || actionsCollection;
return (
<div>
<p>{state!.thing}</p>
<button onClick={(e) => {actions!.changeThing(e, 'bob')} }>push</button>
<p>{_state.thing}</p>
<button onClick={(e) => {_actions.changeThing(e, 'bob')} }>push</button>
</div>

@@ -123,0 +126,0 @@ );