Skip to content

Commit e35b8e9

Browse files
committed
Translation function now doenst trigger unexpected renders
1 parent 85ca5a6 commit e35b8e9

File tree

4 files changed

+3
-13
lines changed

4 files changed

+3
-13
lines changed

example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"dependencies": {
66
"react": "^16.1.1",
77
"react-dom": "^16.1.1",
8-
"react-multi-lang": "^1.0.0",
98
"react-scripts": "1.0.17"
109
},
1110
"scripts": {

example/src/App.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class App extends React.Component {
88
setLanguage(lang)
99
}
1010
render () {
11-
console.log(getLanguage())
1211
return (
1312
<div className="App">
1413
<header className="App-header">
@@ -20,6 +19,8 @@ class App extends React.Component {
2019
<p className="App-intro">
2120
To change language just press the buttons beneath
2221
</p>
22+
<div>Selected lang <b>{getLanguage()}</b></div>
23+
<br/>
2324
<button onClick={() => this.changeLang('pt')}>PT</button>
2425
<button onClick={() => this.changeLang('en')}>EN</button>
2526
</div>

example/yarn.lock

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2935,10 +2935,6 @@ [email protected]:
29352935
version "4.2.0"
29362936
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d"
29372937

2938-
hoist-non-react-statics@^2.3.1:
2939-
version "2.5.0"
2940-
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.0.tgz#d2ca2dfc19c5a91c5a6615ce8e564ef0347e2a40"
2941-
29422938
home-or-tmp@^2.0.0:
29432939
version "2.0.0"
29442940
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
@@ -5131,12 +5127,6 @@ react-error-overlay@^3.0.0:
51315127
version "3.0.0"
51325128
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-3.0.0.tgz#c2bc8f4d91f1375b3dad6d75265d51cd5eeaf655"
51335129

5134-
react-multi-lang@^1.0.0:
5135-
version "1.0.0"
5136-
resolved "https://registry.yarnpkg.com/react-multi-lang/-/react-multi-lang-1.0.0.tgz#0e328d5b3a357f5c6203dd8f0323cceda216ccfd"
5137-
dependencies:
5138-
hoist-non-react-statics "^2.3.1"
5139-
51405130
51415131
version "1.0.17"
51425132
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-1.0.17.tgz#c30029123b561a060227af4d7797d50a222d3fbf"

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export function translate (Component: React$ComponentType<*>): React$ComponentTy
122122

123123
render () {
124124
return (
125-
<Component {...this.props} t={(key: string, args?:{[string]: string}): string => t(key, args)}/>
125+
<Component {...this.props} t={t}/>
126126
)
127127
}
128128
}

0 commit comments

Comments
 (0)