An open API service indexing awesome lists of open source software.

https://github.com/charlypoly/redux-hydrate

Hydrate framework for Redux
https://github.com/charlypoly/redux-hydrate

react redux

Last synced: about 1 month ago
JSON representation

Hydrate framework for Redux

Awesome Lists containing this project

README

          

# redux-hydrate
Hydrate framework for Redux

```typescript

const container = Hydrate.createContainer();

interface Chat {
id: string;
message_ids?: string[]
}

container.register('Chat', {
hasMany: ['Messages']
});

// ...

container.reduxMiddleware();

interface ConnectedProps {
users?: Users[];
messages?: Message[];
message_attachments: MessageAttachment[];
}

interface ComponentProps {
chat: Chat;
}

interface ComponentState {}

type Props = ConnectedProps & ComponentProps;

class Chat extends React.Component {

render() {
return

;
}

}

export default Hydrate.connect(
{
chat: {
users: { ensure: true },
messages: {
message_attachments: {
ensure: true
}
},
}
}
Chat
);

```