-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The Unified useJods Hook
Simplifying Your Remix Integration
jods now offers a unified hook that combines data access and form handling in one elegant API.
// With useJods - one unified hook
const { data, actions } = useJods(todoStore, "addTodo");
return (
<>
<ul>
{data.items.map(item => <li>{item.text}</li>)}
</ul>
<actions.addTodo.Form>
<input name="text" />
<button type="submit">Add</button>
</actions.addTodo.Form>
</>
);Benefits Over Previous Approaches
The unified hook provides a cleaner mental model:
datacontains your reactive store stateactionscontains your form handlers and other actionsloaderDatagives you access to any additional data from your loader
Multi-Store Integration
Where useJods really shines is with multiple stores:
const { data, actions } = useJods([userStore, todoStore], {
user: ["updateProfile"],
todos: ["addTodo", "removeTodo"]
});
// Now you can access:
// - data.user.name
// - data.todos.items
// - actions.user.updateProfile.Form
// - actions.todos.addTodo.FormThis structured approach makes it much easier to organize complex UIs with multiple data sources and forms.
This is additional so you can still use the other things which is nice if you need a more Composable pattern
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request