Skip to content

Commit

Permalink
fix: propagating props which come from parent component
Browse files Browse the repository at this point in the history
fix: propagating props which come from parent component
  • Loading branch information
MadaraUchiha-314 authored Jan 29, 2021
2 parents c657aee + b571605 commit 0811186
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
34 changes: 14 additions & 20 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
{
"root": true,
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"airbnb"
],
"settings": {
"import/extensions": [
".js",
".jsx",
".ts",
".tsx"
]
},
"rules": {
"import/extensions": "off",
"import/no-unresolved": "off"
}
}
"root": true,
"parser": "babel-eslint",
"extends": ["eslint:recommended", "plugin:react/recommended", "airbnb"],
"settings": {
"import/extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"rules": {
"import/extensions": "off",
"import/no-unresolved": "off",
"react/jsx-props-no-spreading": "off",
"max-len": "off",
"object-curly-newline": "off"
}
}
6 changes: 4 additions & 2 deletions src/FormattedMessage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const FormattedMessage = (props) => (
/**
* We get the text to be injected from react's context. Here its TextContext
*/
const { id, values, alt } = props;
const { id, values, alt, ...restProps } = props;
/* eslint-disable-next-line react/destructuring-assignment */
let messageString = Object.prototype.hasOwnProperty.call(context, id) ? context[id] : alt;
/**
Expand All @@ -24,7 +24,9 @@ const FormattedMessage = (props) => (
fontSize: 'inherit',
};
/* eslint-disable react/no-danger */
return <span style={style} dangerouslySetInnerHTML={{ __html: messageString }} />;
return (
<span style={style} dangerouslySetInnerHTML={{ __html: messageString }} {...restProps} />
);
}}
</TextContext.Consumer>
);
Expand Down

0 comments on commit 0811186

Please sign in to comment.