Skip to content

super-html5/ts-react-webpack

 
 

Repository files navigation

This is a simple (admin) starter with typescript, react and webpack.

Have a quick view:

setup

$ npm i

build for development

$ npm run dev

build for production

$ npm run qa/prod

server

We do not use any mock tools(Anyway, you can use the data format from server response to achieve it!), all data interaction depends on a real node service with nest and mongodb. Integration is in our future plan! We will make sure that you still can fully separate client and server side. 😁😁😁

characteristics/packages

TODO

  • config menu by user with permission

functional example

mobx-react-router

import * as React from 'react'
import { inject, observer } from 'mobx-react'
import { Button } from 'antd'

interface IStoreProps {
    routerStore?: RouterStore;
}

function Test({ routerStore }: IStoreProps) {
    const gotoHome = () => {
        routerStore.push('/')
    }
    return (
        <Button type="primary" onClick={gotoHome}>
            go to page index directly
        </Button>
    )
}

export default inject(
    (store: IStore): IStoreProps => ({
        routerStore: store.routerStore
    })
)(observer(Login))

live example

async to load component

import * as React from 'react'
import Loadable from 'react-loadable'
import { HashRouter as Router, Switch, Route } from 'react-router-dom'

import PageLoading from '@components/PageLoading'

const Test = Loadable({
    loader: () => import(/* webpackChunkName: "test" */ './Test'),
    loading: PageLoading
})

const AppRouter = () => (
    <Router>
        <Switch>
            <Route exact path="/test" component={Test} />
        </Switch>
    </Router>
)

export default AppRouter

live example

how to deploy with nginx

server {
       listen       9993;
       server_name  localhost:9993;

       location / {
             root   ~/Documents/react/ts-react-webpack4/dist/qa/;
             index  index.html index.htm;
       }
 }

the scaffold

steamer-react-redux-ts

About

a starter-template with typescript, react, mobx and webpack...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 78.1%
  • JavaScript 15.4%
  • CSS 6.0%
  • HTML 0.5%