This repository was archived by the owner on Aug 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src-examples/simpleReduxDynamicComponentExample Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import {connect} from "react-redux";
66
77import PriceRenderer from "./PriceRenderer" ;
88
9+ const ThemeContext = React . createContext ( 'light' ) ;
10+
911/*
1012 * This component serves to display the row data (provided by redux)
1113 */
Original file line number Diff line number Diff line change 11import React , { Component } from "react" ;
22import { connect } from "react-redux" ;
33
4+ import FontContext from './fontContext'
5+
46class PriceRenderer extends Component {
57 constructor ( props ) {
68 super ( props ) ;
@@ -18,7 +20,9 @@ class PriceRenderer extends Component {
1820
1921 render ( ) {
2022 return (
21- < span > { this . props . currencySymbol } { this . state . convertedValue } </ span >
23+ < FontContext . Consumer >
24+ { fontWeight => < span style = { { fontWeight} } > { this . props . currencySymbol } { this . state . convertedValue } </ span > }
25+ </ FontContext . Consumer >
2226 ) ;
2327 }
2428
@@ -36,5 +40,5 @@ export default connect(
3640 } ,
3741 null ,
3842 null ,
39- { withRef : true } // must be supplied for react/redux when using GridOptions.reactNext
43+ { withRef : true } // must be supplied for react/redux when using GridOptions.reactNext
4044) ( PriceRenderer ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import GridComponent from "./GridComponent";
99
1010import gridData from "./gridDataReducer" ;
1111
12+ import FontContext from './fontContext'
13+
1214let store = createStore ( gridData ) ;
1315
1416/*
@@ -26,7 +28,9 @@ export default class SimpleReduxExample extends Component {
2628 < div >
2729 < h1 > Simple Redux Example using Connected React Components</ h1 >
2830 < HeaderComponent />
29- < GridComponent />
31+ < FontContext . Provider value = "bold" >
32+ < GridComponent />
33+ </ FontContext . Provider >
3034 </ div >
3135 </ Provider >
3236 )
Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+
3+ export default React . createContext ( 'normal' ) ;
You can’t perform that action at this time.
0 commit comments