Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
effector-dom
Advanced tools
import {createStore, createEvent} from 'effector'
import {using, spec, list, h} from 'effector-dom'
using(document.body, () => {
const addLine = createEvent()
const code = createStore('let foo = 0;').on(
addLine,
code => `${code}\nfoo += ${Math.random()}`,
)
h('section', () => {
spec({data: {timelineNames: true}})
list(timelineRows, ({store}) => {
h('div', {
data: {timelineName: true},
text: store,
})
})
})
h('section', () => {
spec({data: {section: 'controls'}})
h('button', {
handler: {click: addLine},
text: 'Add line',
})
})
})
Component is just a plain function
function VizionSectionHeader(text) {
h('header', () => {
spec({data: {vizionSectionHeader: true}})
h('h4', {
text,
})
})
}
effector-react 20.0.3
as const
typescript assertion for useStoreMap
keys. It helps us to infer type for fn
argumentsimport React from 'react'
import {value createStore} from 'effector'
import {value useStoreMap} from 'effector-react'
type User = {
username: string
email: string
bio: string
}
const $users = createStore<User[]>([
{
username: 'alice',
email: 'alice@example.com',
bio: '. . .',
},
{
username: 'bob',
email: 'bob@example.com',
bio: '~/ - /~',
},
{
username: 'carol',
email: 'carol@example.com',
bio: '- - -',
},
])
export const UserProperty = ({id, field}: {id: number; field: keyof User}) => {
const value = useStoreMap({
store: $users,
keys: [id, field] as const,
fn: (users, [id, field]) => users[id][field] || null,
})
return <div>{value}</div>
}
In typescript versions below 3.4, you can still use an explicit type assertion
import React from 'react'
import {value createStore} from 'effector'
import {value useStoreMap} from 'effector-react'
type User = {
username: string
email: string
bio: string
}
const $users = createStore<User[]>([
{
username: 'alice',
email: 'alice@example.com',
bio: '. . .',
},
{
username: 'bob',
email: 'bob@example.com',
bio: '~/ - /~',
},
{
username: 'carol',
email: 'carol@example.com',
bio: '- - -',
},
])
export const UserProperty = ({id, field}: {id: number; field: keyof User}) => {
const value = useStoreMap({
store: $users,
keys: [id, field] as [number, keyof User],
fn: (users, [id, field]) => users[id][field] || null,
})
return <div>{value}</div>
}
as const in typescript docs
FAQs
Effector package for working with dom
The npm package effector-dom receives a total of 19 weekly downloads. As such, effector-dom popularity was classified as not popular.
We found that effector-dom 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.