@cfcs/react
Advanced tools
Comparing version
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/egjs-conveyer | ||
version: 0.0.1 | ||
version: 0.0.2 | ||
*/ | ||
@@ -16,3 +16,6 @@ 'use strict'; | ||
function useReactive(reactiveProps) { | ||
var reactiveState = reactiveProps.state; | ||
var adaptResult = react.useMemo(function () { | ||
return core.adaptReactive(reactiveProps); | ||
}, []); | ||
var reactiveState = adaptResult.state(); | ||
var names = core.keys(reactiveState); | ||
@@ -31,5 +34,2 @@ var states = react.useState({})[0]; | ||
var adaptResult = react.useMemo(function () { | ||
return core.adaptReactive(reactiveProps); | ||
}, []); | ||
var methods = react.useMemo(function () { | ||
@@ -36,0 +36,0 @@ return adaptResult.methods(); |
@@ -7,9 +7,12 @@ /* | ||
repository: https://github.com/naver/egjs-conveyer | ||
version: 0.0.1 | ||
version: 0.0.2 | ||
*/ | ||
import { keys, adaptReactive, camelize } from '@cfcs/core'; | ||
import { useState, useMemo, useEffect } from 'react'; | ||
import { adaptReactive, keys, camelize } from '@cfcs/core'; | ||
import { useMemo, useState, useEffect } from 'react'; | ||
function useReactive(reactiveProps) { | ||
var reactiveState = reactiveProps.state; | ||
var adaptResult = useMemo(function () { | ||
return adaptReactive(reactiveProps); | ||
}, []); | ||
var reactiveState = adaptResult.state(); | ||
var names = keys(reactiveState); | ||
@@ -28,5 +31,2 @@ var states = useState({})[0]; | ||
var adaptResult = useMemo(function () { | ||
return adaptReactive(reactiveProps); | ||
}, []); | ||
var methods = useMemo(function () { | ||
@@ -33,0 +33,0 @@ return adaptResult.methods(); |
{ | ||
"name": "@cfcs/react", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Cross Framework Components", | ||
@@ -35,3 +35,3 @@ "main": "dist/cfcs.cjs.js", | ||
"dependencies": { | ||
"@cfcs/core": "~0.0.1" | ||
"@cfcs/core": "~0.0.2" | ||
}, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
@@ -1,3 +0,3 @@ | ||
import { withReactiveMethods, ReactiveSubscribe, ReactiveAdapter, keys, camelize, adaptReactive } from "@cfcs/core"; | ||
import { useEffect, useRef, useState, useMemo } from "react"; | ||
import { ReactiveSubscribe, ReactiveAdapter, keys, camelize, adaptReactive } from "@cfcs/core"; | ||
import { useEffect, useState, useMemo } from "react"; | ||
import { ReactReactiveResult } from "./types"; | ||
@@ -13,3 +13,4 @@ | ||
>(reactiveProps: ReactiveAdapter<Instance, State, Methods, Data, Events>): ReactReactiveResult<Instance, State, Methods, Events> { | ||
const reactiveState = reactiveProps.state as any; | ||
const adaptResult = useMemo(() => adaptReactive(reactiveProps), []); | ||
const reactiveState = adaptResult.state(); | ||
const names = keys<Record<string, any>>(reactiveState); | ||
@@ -30,3 +31,3 @@ const [states] = useState<Record<string, { | ||
} | ||
const adaptResult = useMemo(() => adaptReactive(reactiveProps), []); | ||
const methods = useMemo(() => adaptResult.methods(), []); | ||
@@ -33,0 +34,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20958
-0.47%Updated