Docs: updates frontend style guides (#25391)

* Update frontend.md

* Update contribute/style-guides/frontend.md

Co-authored-by: Marcus Olsson <accounts+github@marcus.se.net>

Co-authored-by: Marcus Olsson <accounts+github@marcus.se.net>
This commit is contained in:
Hugo Häggmark 2020-06-05 13:54:27 +02:00 committed by GitHub
parent 93a93b5031
commit e55756066b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,8 @@ Generally we follow the Airbnb [React Style Guide](https://github.com/airbnb/jav
- [React](#react) - [React](#react)
- [Props](#props) - [Props](#props)
- [State management](#state-management) - [State management](#state-management)
- [Proposal for removing or replacing Angular dependencies](https://github.com/grafana/grafana/pull/23048)
## Basic rules ## Basic rules
@ -324,6 +326,6 @@ static defaultProps: Partial<Props> = { ... }
## State management ## State management
- Don't mutate state in reducers or thunks. - Don't mutate state in reducers or thunks.
- Use helpers `actionCreatorFactory` and `reducerFactory` instead of traditional `switch statement` reducers in Redux. See [Redux framework](redux.md) for more details. - Use `createSlice`. See [Redux Toolkit](https://redux-toolkit.js.org/) for more details.
- Use `reducerTester` to test reducers. See [Redux framework](redux.md) for more details. - Use `reducerTester` to test reducers. See [Redux framework](redux.md) for more details.
- Use state selectors to access state instead of accessing state directly. - Use state selectors to access state instead of accessing state directly.