Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb2a6a8

Browse files
committed
fixed learn section issue
In learn section the subjects laravel and react are being rendered on the site itself instead of redirecting it to some other resource. The components resposnible to display all the learn page related stuff is not getting the router object through url member in props. This is because we are using custome App.js file for entry point. Now I'm passing the router object as url prop to child components in App so that they can get access to it and behave in the expected manner.
1 parent e162501 commit eb2a6a8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pages/_app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import withData from '../utils/apollo-client';
66

77
class MyApp extends App {
88
render() {
9-
const { Component, pageProps, apollo } = this.props;
9+
const { Component, pageProps, router, apollo } = this.props;
1010
return (
1111
<ApolloProvider client={apollo}>
12-
<Component {...pageProps} />
12+
<Component {...pageProps} url={router} />
1313
</ApolloProvider>
1414
);
1515
}

utils/use-query.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { useQuery as _useQuery } from '@apollo/react-hooks';
2+
3+
const useQuery = query => _useQuery(query, { ssr: false });
4+
5+
export default useQuery;

0 commit comments

Comments
 (0)