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

routing issues #562

Closed
BHARAT703 opened this issue May 1, 2018 · 4 comments
Closed

routing issues #562

BHARAT703 opened this issue May 1, 2018 · 4 comments

Comments

@BHARAT703
Copy link

@coryhouse

Hi there, I am coming from plural sight.
Today I was configuring my router, but it seems like the code is not working any more.
see below snap.

image

so, what is a perfect way to resolve this issue?
I can see there are lots of discussion on this topic like this one #393

but as I am new to react, I don't know which one is correct. can you help me with this? thanks.

@kwelch
Copy link
Collaborator

kwelch commented May 1, 2018

The issue with this is not how you configured the route rather it is the syntax.

Here is what you have

export default {
	<Route path="/" component ={App} >
		<IndexRoute component={HomePage} />
		<Route path="about" component={AboutPage} />
	</Route>
};

This is on the right track but instead of returning this as an object, you need to format this as a function with that JSX returned.
Here is an updated version.

export default () => {
	return (
		<Route path="/" component ={App} >
			<IndexRoute component={HomePage} />
			<Route path="about" component={AboutPage} />
		</Route>
	);
};

By adding the arrow syntax this is now a function then we explicitly return the JSX.

I hope this helps!

@BHARAT703
Copy link
Author

yes, it's worked. errors gone.

I got in wrong direction because I totally followed video.
see this snap of that class in video.

image

but anyway thanks for the help. really appreciate.

@coryhouse
Copy link
Owner

That snap of the video is correct - note that it's using parentheses, not curly braces. :)

@BHARAT703
Copy link
Author

@coryhouse that's true, I just get confused when I saw errors first and then I started seeing conversation in #393, sorry guys..

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

3 participants