JavaScript React Components Managing State and Data Flow Communicating Between Components

Anthony Ogounchi
Anthony Ogounchi
Full Stack JavaScript Techdegree Graduate 14,594 Points

I am getting this error TypeError: props.changeScore is not a function

I am asking the question again because I am getting the same error and even though the question has already been asked previously, there was no answer provided to it.

import React from 'react';

const Counter = (props) => {

  let index = props.index;

  return (
    <div className="counter">
      <button className="counter-action decrement" onClick={() => props.changeScore(index, -1)}> - </button>
      <span className="counter-score">{  props.score }</span>
      <button className="counter-action increment" onClick={() => props.changeScore(index, +1)}> + </button>

export default Counter;

The code you have appears to match the video. You will probably have to post more than this. Can you post App.js?

1 Answer