Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

243
Views
Why am i getting tis error message? Parsing error: '>' expected

So I'm trying to create a context and keep getting this error:

Line 12:31: Parsing error: '>' expected.

I can't seem to find the issue.

import React, { useState, createContext } from 'react';

export const UserContext = createContext({});
export const UserContextProvider: React.FC = ({ children }) => {
  const [number, setNumber] = useState(1);
  const values = {
    number,
    setNumber,
  };
  return <UserContext.Provider value={values}>{children}</UserContext.Provider>;
};

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Hi Marv,

What you are returning is not matching the expected return for a React.FC type.

Please try the following:

export const UserContextProvider: React.FC<{ children: ReactNode }> = ({ children }): ReactElement => {
  const [number, setNumber] = useState(1);
  const values = {
    number,
    setNumber,
  };
  return React.createElement(UserContext.Provider, { value: values }, children);
};
about 4 years ago · Juan Pablo Isaza Report

0

Thanks everyone for the help :D it seem to have sorted itself out when i restarted vs code

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!