tchin-react-components
Tristan Chin's own React components for reuse over future projects
Last updated 4 months ago by maxijonson .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install tchin-react-components 
SYNC missed versions from official npm registry.

tchin-react-components

TRC

My reusable React components.

TRC uses a singleton app to manage the core of the application, such as routes, translations and in my project's case, themes. It also manages the whole Redux store which you can provide its reducers on initialization.

On top of the app singleton, TRC comes with a set of components I plan to use across all my React projects. Most of them were created during my website's development, so it is expected that they may not fit all designs. However, TRC also comes with a premade AppRouter (TRCRouter) which comes with basic functionality.

TRC also comes with a variety of hooks, including useConnect hook which is used to access the Redux store. This hook was created before Redux announced their own set of hooks and may or may not change, because the pattern slightly differs from theirs.

Finally, TRC comes with all dev-dependencies listed as dependencies. This was decided so I can simply install this package without spending much time typing NPM commands to install more dependencies at the cost of a large bundle.

Disclaimer

Please note that this library is being developed for my personal use and should not be used directly in your projects. You can, however, use it as a reference if you're aiming towards the solution TRC is delivering to me. At ANY time, drastic changes could come to the library with no deprecation notice. Use with caution.

Installation

Use the package manager npm to install tchin-react-components.

npm i -S tchin-react-components

Usage

import * as React from "react";
import * as ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { app, APP_ROOT, NotFoundPage, TRCRouter } from "..";

app.init({
    enforceSSL: true /* If you want to force HTTPS */,
    routes: [
        /* your routes here */
        {
            name: "Not Found",
            key: "notFound",
            path: "",
            component: () => <NotFoundPage />,
            hidden: true,
            Icon: () => <span>NF</span>, // Displayed in <Header />.
        },
    ],
    socials: [
        /* Social links displayed in the footer of <Header /> */
        {
            name: "Github",
            url: "https://github.com/maxijonson",
            Icon: () => (
                <FontAwesomeIcon
                    icon={faGithub}
                    color={app.state.theme.colors.defaultText}
                />
            ),
        },
    ],
    translations: {
        /* A set of translations. Only supports FR and EN. */
    },
    reducers: {
        /* your reducers here */
    },
    /* More options available... */
});

ReactDOM.render(
    <Provider store={app.store}>
        <TRCRouter />
    </Provider>,
    document.getElementById(APP_ROOT)
);

License

ISC

Current Tags

  • 1.1.7                                ...           latest (4 months ago)

14 Versions

  • 1.1.7                                ...           4 months ago
  • 1.1.6                                ...           4 months ago
  • 1.1.5                                ...           4 months ago
  • 1.1.4                                ...           4 months ago
  • 1.1.3                                ...           4 months ago
  • 1.1.2                                ...           5 months ago
  • 1.1.1                                ...           5 months ago
  • 1.1.0                                ...           5 months ago
  • 1.0.5                                ...           5 months ago
  • 1.0.4                                ...           5 months ago
  • 1.0.3                                ...           5 months ago
  • 1.0.2                                ...           5 months ago
  • 1.0.1                                ...           5 months ago
  • 1.0.0                                ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 14
Dependencies (84)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |