Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
react-easy-router
Advanced tools
Simple and lightweight alternative to react-router
Usage:
// Main routes file: routes.js
import user from 'modules/user/routes';
import catalog from 'modules/catalog/routes';
export default {
...user,
...catalog
};
// Module route file: modules/user/routes.js
import * as Handlers from './handlers';
import { AppBase } from 'app';
export default {
UserList: {path: '/user/list', component: Handlers.List, wrapper: AppBase},
UserView: {path: '/user/:user_id', component: Handlers.View, wrapper: AppBase}
}
// index file
import React from 'react';
import { render } from 'react-dom';
import { createHistory, useBasename } from 'history'
import routes from './routes';
// Redux store, optional
import store from './store';
import { Provider } from 'react-redux';
// Example for historyCallback
import * as actions from 'modules/core/actions/core';
const history = useBasename(createHistory)({
basename: '/'
});
render((
<Provider store={store}>
<Router
historyCallback={() => {
// do something when route changed
// Example:
store.dispatch(actions.didChangeRoute())
}}
history={history}
notFound={notFound} // optional 404 handler, can be null
routes={routes}/>
</Provider>
), document.getElementById('app'));
Build url:
import { Link } from 'react-easy-router';
...
<Link to="UserView" params={{user_id: 1}} className="user-link" {...props}>Text</Link>
FAQs
The simplest way to add routing to your React app
We found that react-easy-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.