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

RepositoryReadme component doesn't work #72

Closed
jawira opened this issue Nov 17, 2020 · 2 comments
Closed

RepositoryReadme component doesn't work #72

jawira opened this issue Nov 17, 2020 · 2 comments

Comments

@jawira
Copy link

jawira commented Nov 17, 2020

Hi, I tried the example from p.182 (Incorporating React Markdown) and I can't display Readme's content.

My browser show the following error:

Line 21:8: React Hook useEffect has missing dependencies: 'loadReadme' and 'login'. Either include them or remove the dependency array react-hooks/exhaustive-deps

The readme file isn't displayed on CodeSandbox neither (https://codesandbox.io/s/cocky-fog-h6xde?file=/src/App.js), and RepositoryReadme.js has the following error:

Screenshot from 2020-11-17 17-29-18

Don't know if this matters but I'm using Firefox.

@martha-engineer
Copy link

Hello!

You could fix it by adding the login={login} property under the RepoMenu component in the UserRepositories.js file like shown below.

I hope this helps someone learning react!

UserRepositories.js:

import React from 'react';
import { Fetch } from './Fetch';
import RepoMenu from './RepoMenu';

export function UserRepositories({ login, selectedRepo, onSelect = f => f }) {
	return (
		<Fetch
			uri={`https://api.github.com/users/${login}/repos`}
			renderSuccess={({ data }) => (
				<RepoMenu
					repositories={data}
					login={login}
					selectedRepo={selectedRepo}
					onSelect={onSelect}
				/>
			)}
		/>
	);
}

@jawira jawira closed this as completed Dec 24, 2020
@fpigeonjr
Copy link

fpigeonjr commented Sep 26, 2021

Thanks @martha-softwaredeveloper this worked for me.
My <RepoMenu> was missing the login prop.

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