Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for New Versions of React #28

Closed
perkss opened this issue Jan 20, 2018 · 5 comments
Closed

Support for New Versions of React #28

perkss opened this issue Jan 20, 2018 · 5 comments

Comments

@perkss
Copy link

perkss commented Jan 20, 2018

In package.json I do have
"katex": "^0.9.0-beta","react": "^16.2.0", "react-katex": "^1.2.0",

When importing: import { BlockMath } from 'react-katex';

I get the error Uncaught TypeError: Cannot read property 'string' of undefined at Object. (bundle.js:65414) at webpack_require (bundle.js:65334) at Object. (bundle.js:65367) at webpack_require (bundle.js:65334) at bundle.js:65354 at bundle.js:65357 at webpackUniversalModuleDefinition (bundle.js:65307) at Object. (bundle.js:65314) at webpack_require (bundle.js:20) at Object.defineProperty.value

Along with warnings when building:

npm install --save react-katex npm WARN react-katex@1.2.0 requires a peer of katex@^0.7.0 but none is installed. You must install peer dependencies yourself. npm WARN react-katex@1.2.0 requires a peer of react@^15.3.2 but none is installed. You must install peer dependencies yourself. npm WARN react-latex@1.0.1 requires a peer of react@^15.3.0 but none is installed. You must install peer dependencies yourself.

So it seems a bit odd this maybe is the newer version of React supported?

I did try this which maybe related by installing prop types but didnt seem to make a difference installing that.

Setting the versions to this solves the problem:
Removing the warnings has worked so setting the values to:
"react-katex": "1.2.0",
"katex": "^0.7.0",
"react": "15.3.2",

@geyang
Copy link

geyang commented Feb 1, 2018

@talyssonoc I am running into the same problem. Seems that this will require an update on the dist.

@dudko
Copy link
Collaborator

dudko commented Feb 8, 2018

As @talyssonoc commented, it's an issue with outdated module distribution. Release 1.2.0 points to old commit that still uses PropTypes from react 15.x.

Until new release, you can install the module directly from github with

npm i https://github.com/talyssonoc/react-katex.git

and then use it with the following import statement

import { InlineMath } from "react-katex/dist/react-katex";

@sjorsvanheuveln
Copy link

You mean this error?? :

You may need an appropriate loader to handle this file type.
| 
| const InlineMath = ({ html }) => {
|   return <span dangerouslySetInnerHTML={{__html: html}} />;
| };

@dudko
Copy link
Collaborator

dudko commented Feb 18, 2018

@sjorsvanheuveln, yes. That's the error you gonna see after starting react app.

@lillydinhle lillydinhle mentioned this issue Mar 3, 2018
@dudko
Copy link
Collaborator

dudko commented Mar 21, 2018

New version released.

@dudko dudko closed this as completed Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants