kelin2025 / effector-factorio Goto Github PK
View Code? Open in Web Editor NEWThe simplest way to write re-usable features with React + Effector
License: MIT License
The simplest way to write re-usable features with React + Effector
License: MIT License
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/effector
npm ERR! effector@"^22.8.7" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer effector@"^22 | ^23" from [email protected]
npm ERR! node_modules/effector-factorio
npm ERR! effector-factorio@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\konin.mv\AppData\Local\npm-cache\_logs\2023-12-12T10_26_39_333Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: C:\Users\konin.mv\AppData\Local\npm-cache\_logs\2023-12-12T10_26_39_333Z-debug-0.log
Hi. Why model
prop is passed to original view component?
This is needed only for types?
Because I wasn't expected to receive it alongside with my component props.
const FeatureComponentSelect = modelView(factory, (props: SelectProps) => { const model = factory.useModel(); // some code inside return <Select {...props} /> })
So in the DOM I have model
prop passed.
So this is a problem, and I need somehow to make 2 steps to solve this issue
props: SelectProps & { model: ReturnType<typeof factory.useModel> }
model
prop from itSo, my question is - why you pass model
prop to original component if you never use it (model
is always is extracted through factory.useModel
hook)
My suggestion is to separate viewProps from model like this
const { model, ...viewProps } = props;
Привет. Возник вопрос по тому, какие best practices есть по использованию effector-factorio вместе с effector/babel-plugin, чтобы проставлялись sid юнитам. Если условно у меня есть папка features и в каждой фиче есть фабрика.
Since tsdx
does not support "jsx": "react-jsx"
in tsconfig.json
, I transpile it with babel
However, Vite says React is not defined
To fix this, you can add this to vite.config.ts
:
// vite.config.js
import { defineConfig } from 'vite'
export default defineConfig({
esbuild: {
jsxInject: `import React from 'react'`
}
})
But we need to fix it anyway
https://effector.dev/docs/ecosystem-development/unit-shape-protocol
Looks like it would be very useful to use this protocol with useUnit
:
const formFactory = modelFactory((options: FactoryOptions) => {
const loginChanged = createEvent<string>();
const passwordChanged = createEvent<string>();
const submitPressed = createEvent();
const $login = createStore('');
const $password = createStore('');
const $form = combine({ login: $login, password: $password });
const $disabled = options.registerFx.pending;
$login.on(loginChanged, (prev, next) => next);
$password.on(passwordChanged, (prev, next) => next);
sample({
source: $form,
clock: submitPressed,
target: options.registerFx,
});
return {
$login,
$password,
$disabled,
loginChanged,
passwordChanged,
submitPressed,
};
});
const form = formFactory({ registerFx })
function App() {
const { login, password, disabled, loginChanged, passwordChanged, submitPressed } = useUnit(form)
}
But I think it will be very useful to remove $
from the prefix.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.