@esun/dx-api
v0.0.7
Published
达芬奇公共Api
Downloads
3
Readme
1. Setup
Let's install the packages we need:
npm install @esun/dxp-api
2. learn GraphQLClient
@esun/dxp-api
use @fishx/graphql-client
3. Initialize GraphQLClient
import React from 'react';
import { render } from 'react-dom';
import {
GraphQLClient,
useDxGraphQLClient,
DxApiConatiner
} from "@esun/dx-api";
const graphqlServer = ''; // 服务器
const client = new GraphQLClient(graphqlServer, {
headers: {
'X-Requested-With': 'XMLHttpRequest',
},
});
function App() {
// 使用
// const client = useDxGraphQLClient();
return (
<div>
<h2>My first GraphQL app 🚀</h2>
</div>
);
}
render(
<DxApiConatiner client={client}>
<App />
</DxApiConatiner>,
document.getElementById('root'),
);