question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does it support the automatic mode of react 17?

See original GitHub issue

💬 Questions and Help

In react 17, new transforms have been added.

In react 17, the import React from "react" declaration is no longer required. So in my project, I removed the import React from “react” declaration from the svgr template. Then I got the error React is not defined.

export const template: any = (
  { template }: any,
  _: any,
  { componentName, props, jsx }: any,
): any => template.ast`
    import React from 'react'; // i want to remove this declaration
    import { Icon } from '. /ui/Icon';

    const ${componentName} = (${props}) => ${jsx}
    ${componentName}.defaultProps = Icon.defaultProps;
    export default Icon.withComponent(${componentName});
  `;

Is it possible that svgr does not support react 17?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gregbergecommented, Nov 6, 2021

Hello @harxki, https://github.com/gregberge/svgr/pull/613 takes care of it. Not released yet, but will be part of the next v6-alpha.

0reactions
gregbergecommented, Nov 13, 2021

Try to upgrade every packages and to use the new templates API. In releases you will find details about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React v17.0 Release Candidate: No New Features
This means that the older versions of React Native for Web won't be compatible with React 17, but the newer versions will work...
Read more >
Strict Mode - React
Strict mode can't automatically detect side effects for you, but it can help you spot them by making them a little more deterministic....
Read more >
Introducing the New JSX Transform – React Blog
Although React 17 doesn't contain new features, it will provide support for a new version of the JSX transform. In this post, we...
Read more >
React v17.0 – React Blog
React 17 supports the new JSX transform. We've also backported support for it to React 16.14.0, React 15.7.0, and 0.14.10. Note that it...
Read more >
Adopting Concurrent Mode (Experimental) - React
React 18 was released with support for concurrency. However, there is no “mode” ... Concurrent Mode is only available in the experimental builds...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found