Skip to content

React technical exercise for software engineer recruitment - CRUK

Notifications You must be signed in to change notification settings

agoodsell5/cruk-react-exercise

 
 

Repository files navigation

CRUK technical exercise (React)

Task details

  • We will be testing your ability to understand an existing React/Typescript codebase understand what is already and build what is not
  • You will be building a form using the CRUK React Component Library and a form library of your choice such React Hook Form or Formik and a validation library of your choice such as Zod or Yup.
  • This form which will fetch assets from the NASA Images and Video Library API The fields described below will modify the search query.
  • The media returned should be displayed in list below the form, these may be images, video, or audio clips. It is up to you how you display these
  • The user should only see the first 10 items on the page. If you have time, getting this working with some form pagination is a stretch target.
  • Code must be clean and production ready, quality is better than quantity.
  • Feel free to edit this readme or add a new readme file for any additional information, such as what you might do improve your application in the future.
  • Please do not attempt to push to this repo, ideally we would like you to create your own fork.

Tools to be used

Optional Libraries

Form fields

This form has 3 fields and error messages should appear below each field.

Keywords field

Attribute Value
Label Keywords
Name keywords
Required true
Type text
Default ""

Keywords validation

Type Value Message
min length 2 "keywords must have at least 2 characters."
max length 50 "keywords must have at most 50 characters."

An error message should appear below the field

Media type field

Attribute Value
Label Media type
Name mediaType
Required true
Type select
Values [“audio”, “video”, “image”]
Default none

Media types validation

Type Value Message
if unset null or undefined "Please select a media type."

Year start field

Attribute Value
Label Year start
Name yearStart
Required false
Type text
Default ""

Year start validation

Type Value Message
number type any non digit charater "Please enter a valid number."
min 1900 "Year start must be after 1900."
max current year "Year start must not be in the future."

Submit button

Submit button should change to a disabled state and label should read “Submitting…” when user clicks the submit button to submit the form. The button should return to and enabled state with label “Submit” when the API responds.

Tests

Ensure your application has adequate test coverage. It is up to you what test library you use, however Jest and React Testing Library has already been configured. See src/components/HomePage/homePage.test.tsx


This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.tsx. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.ts.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

React technical exercise for software engineer recruitment - CRUK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 78.8%
  • JavaScript 21.2%