0.2.3 • Published 6 years ago

react-router-hash-history v0.2.3

Weekly downloads
92
License
ISC
Repository
-
Last release
6 years ago

React Router Hash History

Use React-Router and History change Page, can use in React \ ReactNative \ ReactXP

npm.io

Install

add package.json

"dependencies": {
  "react-router-hash-history": "git+https://github.com/ymzuiku/react-router-hash-history.git",
}

yarn install:

yarn install

How to use

Create two componen

class Desktop extends React.Component{
  render(){
    return <View>
      <Text>Desktop</Text>
    </View>
  }
}
class Discover extends React.Component{
  render(){
    return <View>
      <Text>Discover</Text>
    </View>
  }
}
// in react or react-native App.js use the components
import {Router, Route, history, Switch,Redirect,hashChange} from 'react-router-hash-history'
class App extends RX.Component {
  componentDidMount(){
    // if begin use other URL page, to be use hashChange()
    hashChange()
  }
  render() {
    return (
      <Router history={history} >
        <View style={[ss.box]} >
          <Text onPress={()=>{
            // changeURL and Router
            history.push('/Discover/')
          }} style={[ss.text]} >Go to Discover</Text>
          <Text  onPress={()=>{
            // changeURL and Router
            history.push('/Desktop/')
          }} style={[ss.text]} >Go to Desktop</Text>
          <Switch >
          <Route exact path='/Discover/*' component={Discover} ></Route>
          <Route exact path='/Desktop/*' component={Desktop} ></Route>
          </Switch>
        </View>
      </Router>
    )
  }
}
0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago