Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inital setup of docusaurus #3165

Merged
merged 16 commits into from Oct 19, 2018
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -5,3 +5,8 @@ dist
lib
es
coverage

website/translated_docs
website/build/
website/node_modules
website/i18n/*
7 changes: 7 additions & 0 deletions docs/FAQ.md
@@ -1,3 +1,10 @@
---
id: faq
title: FAQ
sidebar_label: FAQ
hide_title: true
---

# Redux FAQ

## Table of Contents
Expand Down
7 changes: 7 additions & 0 deletions docs/Feedback.md
@@ -1,3 +1,10 @@
---
id: feedback
title: Feedback
sidebar_label: Feedback
hide_title: true
---

# Feedback

We appreciate feedback from the community. You can post feature requests and bug reports on [Product Pains](https://productpains.com/product/redux).
Expand Down
7 changes: 7 additions & 0 deletions docs/Glossary.md
@@ -1,3 +1,10 @@
---
id: glossary
title: Glossary
sidebar_label: Glossary
hide_title: true
---

# Glossary

This is a glossary of the core terms in Redux, along with their type signatures. The types are documented using [Flow notation](http://flowtype.org/docs/quick-reference.html).
Expand Down
7 changes: 7 additions & 0 deletions docs/Troubleshooting.md
@@ -1,3 +1,10 @@
---
id: troubleshooting
title: Troubleshooting
sidebar_label: Troubleshooting
hide_title: true
---

# Troubleshooting

This is a place to share common problems and solutions to them.
Expand Down
7 changes: 7 additions & 0 deletions docs/advanced/AsyncActions.md
@@ -1,3 +1,10 @@
---
id: async-actions
title: Async Actions
sidebar_label: Async Actions
hide_title: true
---

# Async Actions

In the [basics guide](../basics/README.md), we built a simple todo application. It was fully synchronous. Every time an action was dispatched, the state was updated immediately.
Expand Down
7 changes: 7 additions & 0 deletions docs/advanced/AsyncFlow.md
@@ -1,3 +1,10 @@
---
id: async-flow
title: Async Flow
sidebar_label: Async Flow
hide_title: true
---

# Async Flow

Without [middleware](Middleware.md), Redux store only supports [synchronous data flow](../basics/DataFlow.md). This is what you get by default with [`createStore()`](../api/createStore.md).
Expand Down
7 changes: 7 additions & 0 deletions docs/advanced/ExampleRedditAPI.md
@@ -1,3 +1,10 @@
---
id: example-reddit-api
title: Example: Reddit API
sidebar_label: Example: Reddit API
hide_title: true
---

# Example: Reddit API

This is the complete source code of the Reddit headline fetching example we built during the [advanced tutorial](README.md).
Expand Down
11 changes: 9 additions & 2 deletions docs/advanced/Middleware.md
@@ -1,3 +1,10 @@
---
id: middleware
title: Middleware
sidebar_label: Middleware
hide_title: true
---

# Middleware

You've seen middleware in action in the [Async Actions](../advanced/AsyncActions.md) example. If you've used server-side libraries like [Express](http://expressjs.com/) and [Koa](http://koajs.com/), you were also probably already familiar with the concept of *middleware*. In these frameworks, middleware is some code you can put between the framework receiving a request, and the framework generating a response. For example, Express or Koa middleware may add CORS headers, logging, compression, and more. The best feature of middleware is that it's composable in a chain. You can use multiple independent third-party middleware in a single project.
Expand All @@ -16,7 +23,7 @@ One of the benefits of Redux is that it makes state changes predictable and tran

Wouldn't it be nice if we logged every action that happens in the app, together with the state computed after it? When something goes wrong, we can look back at our log, and figure out which action corrupted the state.

<img src='http://i.imgur.com/BjGBlES.png' width='70%'>
<img src='https://i.imgur.com/BjGBlES.png' width='70%'>

How do we approach this with Redux?

Expand Down Expand Up @@ -273,7 +280,7 @@ Because it is cumbersome to apply functions to `createStore()` before using it,

#### Caveat: Dispatching During Setup

While `applyMiddleware` executes and sets up your middleware, the `store.dispatch` function will point to the vanilla version provided by `createStore`. Dispatching would result in no other middleware being applied. If you are expecting an interaction with another middleware during setup, you will probably be disappointed. Because of this unexpected behavior, `applyMiddleware` will throw an error if you try to dispatch an action before the set up completes. Instead, you should either communicate directly with that other middleware via a common object (for an API-calling middleware, this may be your API client object) or waiting until after the middleware is constructed with a callback.
While `applyMiddleware` executes and sets up your middleware, the `store.dispatch` function will point to the vanilla version provided by `createStore`. Dispatching would result in no other middleware being applied. If you are expecting an interaction with another middleware during setup, you will probably be disappointed. Because of this unexpected behavior, `applyMiddleware` will throw an error if you try to dispatch an action before the set up completes. Instead, you should either communicate directly with that other middleware via a common object (for an API-calling middleware, this may be your API client object) or waiting until after the middleware is constructed with a callback.

### The Final Approach

Expand Down
7 changes: 7 additions & 0 deletions docs/advanced/NextSteps.md
@@ -1,3 +1,10 @@
---
id: next-steps
title: Next Steps
sidebar_label: Next Steps
hide_title: true
---

# Next Steps

If you landed in this section, you might be wondering at this point, "what should I do now?". Here is where we provide some essential tips/suggestions on how to diverge from creating trivial TodoMVC apps to a real world application.
Expand Down
7 changes: 7 additions & 0 deletions docs/advanced/README.md
@@ -1,3 +1,10 @@
---
id: advanced
title: Advanced
sidebar_label: Advanced
hide_title: true
---

# Advanced

In the [basics walkthrough](../basics/README.md), we explored how to structure a simple Redux application. In this walkthrough, we will explore how AJAX and routing fit into the picture.
Expand Down
7 changes: 7 additions & 0 deletions docs/advanced/UsageWithReactRouter.md
@@ -1,3 +1,10 @@
---
id: usage-with-react-router
title: Usage with React Router
sidebar_label: Usage with React Router
hide_title: true
---

# Usage with React Router

So you want to do routing with your Redux app. You can use it with [React Router](https://github.com/ReactTraining/react-router). Redux will be the source of truth for your data and React Router will be the source of truth for your URL. In most of the cases, **it is fine** to have them separate unless you need to time travel and rewind actions that trigger a URL change.
Expand Down
7 changes: 7 additions & 0 deletions docs/api/README.md
@@ -1,3 +1,10 @@
---
id: api-reference
title: API Reference
sidebar_label: API Reference
hide_title: true
---

# API Reference

The Redux API surface is tiny. Redux defines a set of contracts for you to implement (such as [reducers](../Glossary.md#reducer)) and provides a few helper functions to tie these contracts together.
Expand Down
9 changes: 8 additions & 1 deletion docs/api/Store.md
@@ -1,3 +1,10 @@
---
id: store
title: Store
sidebar_label: Store
hide_title: true
---

# Store

A store holds the whole [state tree](../Glossary.md#state) of your application.
Expand Down Expand Up @@ -90,7 +97,7 @@ You may call [`dispatch()`](#dispatch) from a change listener, with the followin

3. The listener should not expect to see all state changes, as the state might have been updated multiple times during a nested [`dispatch()`](#dispatch) before the listener is called. It is, however, guaranteed that all subscribers registered before the [`dispatch()`](#dispatch) started will be called with the latest state by the time it exits.

It is a low-level API. Most likely, instead of using it directly, you'll use React (or other) bindings. If you commonly use the callback as a hook to react to state changes, you might want to [write a custom `observeStore` utility](https://github.com/reduxjs/redux/issues/303#issuecomment-125184409). The `Store` is also an [`Observable`](https://github.com/zenparsing/es-observable), so you can `subscribe` to changes with libraries like [RxJS](https://github.com/ReactiveX/RxJS).
It is a low-level API. Most likely, instead of using it directly, you'll use React (or other) bindings. If you commonly use the callback as a hook to react to state changes, you might want to [write a custom `observeStore` utility](https://github.com/reduxjs/redux/issues/303#issuecomment-125184409). The `Store` is also an [`Observable`](https://github.com/zenparsing/es-observable), so you can `subscribe` to changes with libraries like [RxJS](https://github.com/ReactiveX/RxJS).

To unsubscribe the change listener, invoke the function returned by `subscribe`.

Expand Down
7 changes: 7 additions & 0 deletions docs/api/applyMiddleware.md
@@ -1,3 +1,10 @@
---
id: apply-middleware
title: applyMiddleware
sidebar_label: applyMiddleware
hide_title: true
---

# `applyMiddleware(...middleware)`

Middleware is the suggested way to extend Redux with custom functionality. Middleware lets you wrap the store's [`dispatch`](Store.md#dispatch) method for fun and profit. The key feature of middleware is that it is composable. Multiple middleware can be combined together, where each middleware requires no knowledge of what comes before or after it in the chain.
Expand Down
13 changes: 10 additions & 3 deletions docs/api/bindActionCreators.md
@@ -1,3 +1,10 @@
---
id: bind-action-creators
title: bindActionCreators
sidebar_label: bindActionCreators
hide_title: true
---

# `bindActionCreators(actionCreators, dispatch)`

Turns an object whose values are [action creators](../Glossary.md#action-creator), into an object with the same keys, but with every action creator wrapped into a [`dispatch`](Store.md#dispatch) call so they may be invoked directly.
Expand Down Expand Up @@ -53,11 +60,11 @@ console.log(TodoActionCreators)
// }

class TodoListContainer extends Component {
constructor(props) {
constructor(props) {
super(props);

const {dispatch} = props;

// Here's a good use case for bindActionCreators:
// You want a child component to be completely unaware of Redux.
// We create bound versions of these functions now so we can
Expand Down
9 changes: 8 additions & 1 deletion docs/api/combineReducers.md
@@ -1,3 +1,10 @@
---
id: combine-reducers
title: combineReducers
sidebar_label: combineReducers
hide_title: true
---

# `combineReducers(reducers)`

As your app grows more complex, you'll want to split your [reducing function](../Glossary.md#reducer) into separate functions, each managing independent parts of the [state](../Glossary.md#state).
Expand All @@ -13,7 +20,7 @@ rootReducer = combineReducers({potato: potatoReducer, tomato: tomatoReducer})
// This would produce the following state object
{
potato: {
// ... potatoes, and other state managed by the potatoReducer ...
// ... potatoes, and other state managed by the potatoReducer ...
},
tomato: {
// ... tomatoes, and other state managed by the tomatoReducer, maybe some nice sauce? ...
Expand Down
7 changes: 7 additions & 0 deletions docs/api/compose.md
@@ -1,3 +1,10 @@
---
id: compose
title: compose
sidebar_label: compose
hide_title: true
---

# `compose(...functions)`

Composes functions from right to left.
Expand Down
7 changes: 7 additions & 0 deletions docs/api/createStore.md
@@ -1,3 +1,10 @@
---
id: create-store
title: createStore
sidebar_label: createStore
hide_title: true
---

# `createStore(reducer, [preloadedState], [enhancer])`

Creates a Redux [store](Store.md) that holds the complete state tree of your app.
Expand Down
8 changes: 7 additions & 1 deletion docs/basics/Actions.md
@@ -1,3 +1,10 @@
---
id: actions
title: Actions
sidebar_label: Actions
hide_title: true
---

# Actions

First, let's define some actions.
Expand Down Expand Up @@ -147,4 +154,3 @@ export function setVisibilityFilter(filter) {
## Next Steps

Now let's [define some reducers](Reducers.md) to specify how the state updates when you dispatch these actions!

7 changes: 7 additions & 0 deletions docs/basics/DataFlow.md
@@ -1,3 +1,10 @@
---
id: data-flow
title: Data flow
sidebar_label: Data flow
hide_title: true
---

# Data Flow

Redux architecture revolves around a **strict unidirectional data flow**.
Expand Down
7 changes: 7 additions & 0 deletions docs/basics/ExampleTodoList.md
@@ -1,3 +1,10 @@
---
id: example
title: Example: Todo List
sidebar_label: Example: Todo List
hide_title: true
---

# Example: Todo List

This is the complete source code of the tiny todo app we built during the [basics tutorial](./README.md). This code is also in [our repository of examples](https://github.com/reduxjs/redux/tree/master/examples/todos/src) and can be [run in your browser via CodeSandbox](https://codesandbox.io/s/github/reduxjs/redux/tree/master/examples/todos).
Expand Down
7 changes: 7 additions & 0 deletions docs/basics/README.md
@@ -1,3 +1,10 @@
---
id: basics
title: Basics
sidebar_label: Basics
hide_title: true
---

# Basics

Don't be fooled by all the fancy talk about reducers, middleware, store enhancers—Redux is incredibly simple. If you've ever built a Flux application, you will feel right at home. If you're new to Flux, it's easy too!
Expand Down
7 changes: 7 additions & 0 deletions docs/basics/Reducers.md
@@ -1,3 +1,10 @@
---
id: reducers
title: Reducers
sidebar_label: Reducers
hide_title: true
---

# Reducers

**Reducers** specify how the application's state changes in response to [actions](./Actions.md) sent to the store. Remember that actions only describe *what happened*, but don't describe how the application's state changes.
Expand Down
9 changes: 8 additions & 1 deletion docs/basics/Store.md
@@ -1,3 +1,10 @@
---
id: store
title: Store
sidebar_label: Store
hide_title: true
---

# Store

In the previous sections, we defined the [actions](Actions.md) that represent the facts about “what happened” and the [reducers](Reducers.md) that update the state according to those actions.
Expand Down Expand Up @@ -61,7 +68,7 @@ unsubscribe()

You can see how this causes the state held by the store to change:

<img src='http://i.imgur.com/zMMtoMz.png' width='70%'>
<img src='https://i.imgur.com/zMMtoMz.png' width='70%'>

We specified the behavior of our app before we even started writing the UI. We won't do this in this tutorial, but at this point you can write tests for your reducers and action creators. You won't need to mock anything because they are just [pure](../introduction/ThreePrinciples.md#changes-are-made-with-pure-functions) functions. Call them, and make assertions on what they return.

Expand Down
7 changes: 7 additions & 0 deletions docs/basics/UsageWithReact.md
@@ -1,3 +1,10 @@
---
id: usage-with-react
title: Usage with React
sidebar_label: Usage with React
hide_title: true
---

# Usage with React

From the very beginning, we need to stress that Redux has no relation to React. You can write Redux apps with React, Angular, Ember, jQuery, or vanilla JavaScript.
Expand Down
7 changes: 7 additions & 0 deletions docs/faq/Actions.md
@@ -1,3 +1,10 @@
---
id: actions
title: Actions
sidebar_label: Actions
hide_title: true
---

# Redux FAQ: Actions

## Table of Contents
Expand Down
7 changes: 7 additions & 0 deletions docs/faq/CodeStructure.md
@@ -1,3 +1,10 @@
---
id: code-structure
title: Code structure
sidebar_label: Code structure
hide_title: true
---

# Redux FAQ: Code Structure

## Table of Contents
Expand Down
7 changes: 7 additions & 0 deletions docs/faq/DesignDecisions.md
@@ -1,3 +1,10 @@
---
id: design-decisions
title: Design decisions
sidebar_label: Design decisions
hide_title: true
---

# Redux FAQ: Design Decisions

## Table of Contents
Expand Down
7 changes: 7 additions & 0 deletions docs/faq/General.md
@@ -1,3 +1,10 @@
---
id: general
title: General
sidebar_label: General
hide_title: true
---

# Redux FAQ: General

## Table of Contents
Expand Down