DAB0mB / Appfairy

A CLI tool to Migrate a Webflow project into a React app
MIT License
287 stars 39 forks source link

React-router warnings #11

Open Geofflew opened 5 years ago

Geofflew commented 5 years ago

First off, love this app! Rely on it a lot.

I noticed that when I was using react-router to navigate (Link and history.push) it was throwing me an error of

TypeError: e is not a function r.define src/views/DiscoverView.js:38 35 | componentDidMount() { 36 | scripts.concat(Promise.resolve()).reduce((loaded, loading) => { 37 | return loaded.then(script => { > 38 | new Function(`with (this) {eval(arguments[0])} | ^ 39 | `).call(window, script); 40 | 41 | return loading;

I managed to fix it by manually going into the appfairy generated view page and adding a "$" in front of it, changing it to "$ {eval(arguments[0])}", and now it works fine with react-router

Not sure whether its just the way I am using appfairy, or generating the pages, but posting this here just in case other people have the same issue

tnici commented 5 years ago

Same thing for me. Thanks for posting your workaround.

constantinX commented 4 years ago

Thanks a lot. It is working for me.

JeffreyYu2018 commented 4 years ago

Thanks, this worked for me too.

DAB0mB commented 3 years ago

Your solution might have potential side effects because you run evaluation on the same scope, I would need more info inorder to tackle that, have an example repo or something

hosseinSey commented 3 years ago

First, great solution! thanks I had the same issue when using the router and used the $ workaround to solve it but appreciate a more sustainable solution

Instrumedley commented 2 years ago

I have the same issue. In my case is not a warning, but an error and the solution provided here did not work although it's not really a proper solution anyway since it will require that manual change every time the views are updated. Any news on this?

Instrumedley commented 2 years ago

to be fair, the solution provided here seems unreadable. He says and adding a " {eval(arguments[0])}", and now it works fine with react-router I don't know if since the day he posted git might be parsing some character he wrote there, but I don't quite understand what Im supposed to do. Can anyone help?