inline-connect
v0.0.1
Published
Connect your components inline.
Downloads
3
Readme
#Installation
yarn add inline-connect
#Example
const App = () => {
const fields = useSelector((state: State) => state.Component1.fields);
const dispatch = useDispatch();
return (
<div className="App">
{fields.map((str, index) => {
return (
<Connected
selectors={[(state: State) => state.Component1.fields[index]]}
actions={[
(e: any) =>
dispatch({ type: "SET_FIELD", index, value: e.target.value })
]}
>
{str => log => {
return <input value={str} onChange={log} />;
}}
</Connected>
);
})}
</div>
);
};