open-index/open-npm huggingface dataset:
npm package: @saber2pr/react
Description: react in Typescript.
Author: saber2pr
Latest version: 0.3.3

# @saber2pr/react

> react in typescript.

```bash
yarn add @saber2pr/react
```

## Examples

1. CSR

render Component to DOM in browser.

```tsx
import React, {
  useCallBack,
  useMemo,
  useReducer,
  useRef,
  useState
} from "@saber2pr/react"
import ReactDOM from "@saber2pr/react/lib/client"

function HelloMessage({ name }: { name: string }) {
  return <div>Hello {name}</div>
}

ReactDOM.render(
  <HelloMessage name="Taylor" />,
  document.getElementById("container")
)
```

[examples](https://saber2pr.top/react/)

2. SSR

render Component to string.

```tsx
import React from "@saber2pr/react"
import ReactDOMServer from "@saber2pr/react/lib/server"

const Content = ({ content }: { content: string }) => (
  <div>
    <div style={{ color: "red" }}>{content}</div>
    <button onclick={() => console.log("click")}>click</button>
  </div>
)

const App = () => {
  return (
    <div>
      <div>This is a SSR Demo</div>
      <Content content="has color" />
    </div>
  )
}

console.log(ReactDOMServer.renderToString(<App />))
```

3. Custom Render

create a custom renderer.

```tsx
import React from "@saber2pr/react"
import ReactFiberReconciler from "@saber2pr/react/lib/reconciler"

// use your host config.
const Renderer = ReactFiberReconciler(HostConfig)

const Store = {
  state: 0
}

const TestCreateRenderer = () => {
  const state = Store.state
  return (
    <div>
      <hr />
      <div>This is a UpdateContainer Test</div>
      <div>{state}</div>
      <button
        onclick={() => {
          Store.state++
          // update
          Renderer.updateContainer(<TestCreateRenderer />, container)
        }}
      >
        add
      </button>
    </div>
  )
}

// init render
Renderer.createContainer(
  <TestCreateRenderer />,
  document.getElementById("container")
)
```

---

### Dev

```bash
yarn install

yarn start

yarn dev
```

## License

MIT

> Author: saber2pr

## Reference

[facebook/react](https://github.com/facebook/react)
npm package: @saberd/dconf-json
Description: export and edit gnome linux dconf settings
Author: saberd
Latest version: 0.1.11

# Dconf Json

Convert linux gnome config to json and back  
To get the gnome .conf file use:

```bash
dconf dump / > FILENAME.conf
```

Example usage to convert conf and store as json file and take json and store as conf file
```js
const dconfjson = require('dconf-json');

dconfjson.json_writer("FILENAME.conf", dest="FILENAME.json")
dconfjson.dconf_writer("FILENAME.json", dest="FILENAME_2.conf")
```

To load new dconf parameters into gnome use (bash):

```bash
dconf load / < FILENAME_2.conf
```

To get the gnome config out as a javascript json use:

```js
const fs = require('fs');
const dconfjson = require('dconf-json');

const dconf_path = 'path/to/dconf/file';
const dconf = fs.readFileSync(dconf_path, 'utf-8');
const config_json = dconfjson.dconf_json(dconf);
```

## Without using files
To get the dconf out as json without using files:
```js
const { execSync } = require('child_process');
const dconfjson = require('dconf-json');

const spath = "/org/gnome/terminal/legacy/profiles:/";
const cmd = `dconf dump ${spath}`;
const s_out = execSync(cmd).toString('utf-8');
const config_json = dconfjson.dconf_json(s_out);
```