Skip to content

Commit

Permalink
Merge pull request #83 from nonopolarity/patch-1
Browse files Browse the repository at this point in the history
grammatical
  • Loading branch information
eyeccc committed Mar 25, 2021
2 parents dfff905 + d613629 commit 533d414
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ path: "/different-ways-of-getting-react-context-val"
---

Recently I am refactoring our code base for extracting out similar logic to [React Context](https://reactjs.org/docs/context.html).
Since our code base has maintained by several developers over the years, there are a lot of different kinds of coding style.
Since our code base has been maintained by several developers over the years, there are a lot of different kinds of coding style.
I would like to write a post to note down how to use React Context value in different situations.

Supposed we have a context look like the following:
Suppose we have a context that looks like the following:

```javascript
import React from 'react';
Expand Down Expand Up @@ -46,7 +46,7 @@ export const useMyContext = () => {

#### Class Component

First, in **class component**, we could write it like what official document suggests:
First, in **class component**, we could write it like what the official document suggests:

```javascript
import { MyContext } from './myContext';
Expand Down Expand Up @@ -145,4 +145,4 @@ let make = () => {

```
If I encounter more ways to get context value, I will update this post :D
If I encounter more ways to get context value, I will update this post :D

0 comments on commit 533d414

Please sign in to comment.