An open API service indexing awesome lists of open source software.

https://github.com/suhdev/stickyants-react-router

A basic react-router alternative using react hooks.
https://github.com/suhdev/stickyants-react-router

Last synced: about 1 year ago
JSON representation

A basic react-router alternative using react hooks.

Awesome Lists containing this project

README

          

# stickyants-react-router

A simple `react-router` alternative. The package implements basic routing functionality using react hooks.

## Usage

```typescript

import * as React from 'react';
import * as ReactDOM from 'react-dom';

import { Route, Router, createHashHistory } from 'stickyants-react-router';

import * as React from 'react';
import * as ReactDOM from 'react-dom';

const history = createHashHistory();

function TestComponent(props) {
return (



Home




Page 1


Page 1 - Sub Page




);
}

let el = document.getElementById('SomeElement');
if (!el) {
el = document.createElement('div');
el.id = 'SomeElement';
document.querySelector('body').appendChild(el);
}

ReactDOM.render(

TMX

TMZ


NESTED ROUTE


SAME NESTED ROUTE




ANOTHER NESTED ROUTE



STRING NESTED ROUTE



ELEMENT NESTED ROUTE




XYZ


INCORRECT


,
el);

```