diff --git a/README.md b/README.md index bcd95b3..e427865 100644 --- a/README.md +++ b/README.md @@ -271,6 +271,8 @@ export default view(() => (
Wrap ALL of your components with view - including class and function ones - even if they don't seem to directly use a store.

+ +Every component that is using a store or part of a store inside its render must be wrapped with `view`. Sometimes store usage is not so explicit and easy to to miss. ```jsx import { view, store } from '@risingstack/react-easy-state'; @@ -294,6 +296,20 @@ const Profile = view(({ user }) =>

Name: {user.name}

); const Profile = ({ user }) =>

Name: {user.name}

; ``` +If you are **100% sure** that your component is not using any stores you can skip the `view` wrapper. + +```jsx +import React from 'react'; + +// you don't have to wrap this component with `view` +export default (() =>

This is just plain text

); +``` + +`view` wrapping is advised even in these cases though. + +- It saves you from future headaches as your project grows and you start to use stores inside these components. +- `view` is pretty much equivalent to `memo` if you don't use any stores. That is nearly always nice to have. +