The days of communicating with your data store using an imperative API are over. Simply declare your data requirements and let Interact fetch and mutate your data when needed.
Queries live next to the views that rely on them, so you can easily reason about your app. No more complex state management systems and data flow.
Plug it in and start communicating immediately with your existing REST API or other 3rd party APIs. No specialized server-side architechture needed.
import React, { Component } from 'react'
import { createContainer } from 'react-interact'
class TodoList extends Component {
render() {
return <div>
{this.props.todos.map(todo => {
return `${todo.title}, `
})}
</div>
},
}
export default createContainer(TodoList, () => ({
todos: '/api/v1/todos',
}))
GET /api/v1/todos
[
{id: 1, title: 'Laundry'},
{id: 2, title: 'Weights'},
{id: 3, title: 'Stroke the cat'},
]
Laundry, Weights, Stroke the cat,