项目作者: developit

项目描述 :
:repeat: Preact + Redux Example Project
高级语言: JavaScript
项目地址: git://github.com/developit/preact-redux-example.git
创建时间: 2016-02-07T04:19:06Z
项目社区:https://github.com/developit/preact-redux-example

开源协议:

下载


Preact Redux Example

A 9kb Preact + Redux boilerplate built with Preact CLI, implementing a To-Do List app.

As of v2, now wonderfully simplified via preact-redux (no more preact-compat!).


Quick-Start Guide

Installation

1. Clone this repo:

  1. git clone https://github.com/developit/preact-redux-example.git my-app
  2. cd my-app

2. Make it your own:

  1. rm -rf .git && git init && npm init

:information_source: This re-initializes the repo and sets up your NPM project.

3. Install the dependencies:

  1. npm install

You’re done installing! Now let’s get started developing.

Development Workflow

4. Start a live-reload development server:

  1. PORT=8080 npm run dev

This is a full web server nicely suited to your project. Any time you make changes within the src directory, it will rebuild and even refresh your browser.

5. Generate a production build in ./build:

  1. npm run build

You can now deploy the contents of the build directory to production!

Example: deploy to surge.sh:

npm i surge && surge build -d my-app.surge.sh


Structure

Apps are built up from simple units of functionality called Components. A Component is responsible for rendering a small part of an application, given some input data called props, generally passed in as attributes in JSX. A component can be as simple as:

  1. class Link extends Component {
  2. render({ to, children }) {
  3. return <a href={ to }>{ children }</a>;
  4. }
  5. }
  6. // usage:
  7. <Link to="/">Home</Link>

License

MIT