New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bloc-js/react-bloc

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bloc-js/react-bloc - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

2

lib-es/use-bloc-state.d.ts
import { Bloc } from "@bloc-js/bloc";
export declare type CreateBlocFn<S> = () => Bloc<S>;
export declare function useBlocState<S>(blocCreator: Bloc<S> | CreateBlocFn<S>): S | null;
export declare function useBlocState<S>(blocCreator: Bloc<S> | CreateBlocFn<S>): S;

@@ -1,8 +0,8 @@

import { useEffect, useState } from "react";
import { useEffect, useState, useRef } from "react";
export function useBlocState(blocCreator) {
var _a = useState(null), state = _a[0], setState = _a[1];
var ref = useRef(typeof blocCreator === "function" ? blocCreator() : blocCreator);
var _a = useState(ref.current.value), state = _a[0], setState = _a[1];
useEffect(function () {
var bloc = ref.current;
var shouldDispose = typeof blocCreator === "function";
var bloc = typeof blocCreator === "function" ? blocCreator() : blocCreator;
setState(bloc.value);
var subscription = bloc.subscribe(function (nextState) {

@@ -16,5 +16,5 @@ setState(nextState);

};
}, []);
}, [ref]);
return state;
}
//# sourceMappingURL=use-bloc-state.js.map
import { Bloc } from "@bloc-js/bloc";
export declare type CreateBlocFn<S> = () => Bloc<S>;
export declare function useBlocState<S>(blocCreator: Bloc<S> | CreateBlocFn<S>): S | null;
export declare function useBlocState<S>(blocCreator: Bloc<S> | CreateBlocFn<S>): S;

@@ -1,8 +0,8 @@

import { useEffect, useState } from "react";
import { useEffect, useState, useRef } from "react";
export function useBlocState(blocCreator) {
const [state, setState] = useState(null);
const ref = useRef(typeof blocCreator === "function" ? blocCreator() : blocCreator);
const [state, setState] = useState(ref.current.value);
useEffect(() => {
const bloc = ref.current;
const shouldDispose = typeof blocCreator === "function";
const bloc = typeof blocCreator === "function" ? blocCreator() : blocCreator;
setState(bloc.value);
const subscription = bloc.subscribe(nextState => {

@@ -16,5 +16,5 @@ setState(nextState);

};
}, []);
}, [ref]);
return state;
}
//# sourceMappingURL=use-bloc-state.js.map
import { Bloc } from "@bloc-js/bloc";
export declare type CreateBlocFn<S> = () => Bloc<S>;
export declare function useBlocState<S>(blocCreator: Bloc<S> | CreateBlocFn<S>): S | null;
export declare function useBlocState<S>(blocCreator: Bloc<S> | CreateBlocFn<S>): S;

@@ -5,7 +5,7 @@ "use strict";

function useBlocState(blocCreator) {
var _a = react_1.useState(null), state = _a[0], setState = _a[1];
var ref = react_1.useRef(typeof blocCreator === "function" ? blocCreator() : blocCreator);
var _a = react_1.useState(ref.current.value), state = _a[0], setState = _a[1];
react_1.useEffect(function () {
var bloc = ref.current;
var shouldDispose = typeof blocCreator === "function";
var bloc = typeof blocCreator === "function" ? blocCreator() : blocCreator;
setState(bloc.value);
var subscription = bloc.subscribe(function (nextState) {

@@ -19,3 +19,3 @@ setState(nextState);

};
}, []);
}, [ref]);
return state;

@@ -22,0 +22,0 @@ }

{
"name": "@bloc-js/react-bloc",
"version": "2.0.4",
"version": "2.0.5",
"description": "React components for implementing the BLoC pattern.",

@@ -49,3 +49,3 @@ "keywords": [

},
"gitHead": "20ec2962c4d6142893cef84ab41d44132b706730"
"gitHead": "097ad3aeaf99796cc707e54296b5e708dff55756"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc