# react-weixin-title

> Provides a declarative way to specify document.title in weixin for iOS.

Latest version **1.0.2** (published 2016-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-weixin-title
pnpm add react-weixin-title
yarn add react-weixin-title
bun add react-weixin-title
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-11-27 |
| First published | 2016-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | yahiousun |
| Maintainers | yahiousun |

## Links

- npm: https://www.npmjs.com/package/react-weixin-title
- Repository: https://github.com/yahiousun/react-weixin-title
- Homepage: https://github.com/yahiousun/react-weixin-title#readme
- Issues: https://github.com/yahiousun/react-weixin-title/issues
- npm.io page: https://npm.io/package/react-weixin-title

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^15.4.1
- [react-dom](https://npm.io/package/react-dom.md) ^15.4.1
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.11.6

## Recent versions

- 1.0.2 (latest) — 2016-11-27
- 1.0.1 — 2016-11-27
- 1.0.0 — 2016-11-27

## README

# React Weixin Title
Provides a declarative way to specify document.title in a single-page app.  
This component can be used on weixin for iOS as well.

## Installation
```sh
npm install --save react-weixin-title
```

## Example
Assuming you use something like [react-router](https://github.com/ReactTraining/react-router):

```javascript
import React from 'react';
import { render } from 'react-dom';
import { Router, Route, IndexRoute, hashHistory } from 'react-router';
import { ChangeWeixinTitle } from 'react-weixin-title';

import App from './containers/App';
import Home from './routes/Home';
import GettingStarted from './routes/GettingStarted';

import './styles/styles.scss';

const title = 'React Weixin Title'; //your title here
const src = '/favicon.ico'; //a valid url, i.e. '/favicon.ico'

render((
  <Router history={hashHistory}>
    <Route path="/" component={App}>
      <IndexRoute component={Home} onEnter={() => new ChangeWeixinTitle(title, src)} />
      <Route path="getting-started" component={GettingStarted} />
    </Route>
  </Router>
), document.getElementById('app'));
```
Or use WeixinTitle component

```javascript
import React from 'react';
import { WeixinTitle } from 'react-weixin-title';

const title = 'your title here'; //your title here
const src = '/favicon.ico'; //a valid url, i.e. favicon.ico

class Demo extends React.Component {
  render() {
    return (
      <WeixinTitle title={title} src={src}>
        //your code here
      </WeixinTitle>
    )
  }
}
```

## Live Demo
![react-weixin-title](https://raw.githubusercontent.com/yahiousun/react-weixin-title/master/example/images/qrcode.jpg)

## References
[微信前端开发有哪些坑或者黑魔法？](https://www.zhihu.com/question/27849091#)

## License
Copyright © 2016 yahiousun. This source code is licensed under the MIT license found in the [LICENSE](https://github.com/yahiousun/react-weixin-title/blob/master/LICENSE) file.

---
_Source: https://npm.io/package/react-weixin-title · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
