https://github.com/themost-framework/react
MOST Web Framework client module for react
https://github.com/themost-framework/react
api api-client client react
Last synced: about 1 month ago
JSON representation
MOST Web Framework client module for react
- Host: GitHub
- URL: https://github.com/themost-framework/react
- Owner: themost-framework
- License: bsd-3-clause
- Created: 2019-09-18T06:25:14.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-01-27T07:16:20.000Z (over 2 years ago)
- Last Synced: 2025-08-16T03:34:17.383Z (10 months ago)
- Topics: api, api-client, client, react
- Language: TypeScript
- Homepage:
- Size: 2.72 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @themost/react

> [@themost-framework](https://github.com/themost-framework/) client library for react based on [@themost/client](https://github.com/themost-framework/client)
[](https://www.npmjs.com/package/@themost/react)  [](https://github.com/themost-framework/react/blob/master/LICENSE)  
## Install
```bash
npm install --save @themost/react
```
## Usage
Create application data context
```tsx
import React from 'react'
import { ReactDataContext } from '@themost/react'
export const context = React.createContext(new ReactDataContext('http://api.example.com/api/'))
```
where `new ReactDataContext(string)` is being used for defining the remote api server
and use context in any component e.g.
```tsx
import React from 'react'
import { context } from './context'
interface CustomersState {
items: any[]
}
export default class Customers extends React.Component<{}, CustomersState> {
constructor(props: any) {
super(props)
this.state = { items: [] }
}
componentDidMount() {
context
.model('People')
.asQueryable()
.getItems()
.then((items) => {
this.setState({
items
})
})
}
render() {
return (
<>
...
>
)
}
}
```
## License
BSD-3-Clause © [THEMOST LP](License)