# Task: Create a post

## Task: Create a post

* Add a button to the List View that directs you to a page on which you can create a new post
* Add a page for writing a new post
* Check out the server-repo to see which fields are required upon creating a new post
* Add a route for this component. For example "./new" or "./write-post" or something like this
* Validate the user-input before sending the new post to the server
* The validation-functions should be separate functions
* The validation-functions should be tested
* The validation-functions should be written by you (so no library for those)
* The validation functions should validate required fields and also validate that the length of a string meets a certain range. The length-constraints are up to you, as an example a name could be anything between 2 and 40 characters, a title could be 10 characters up to 120 etc. etc.
* You are allowed to use a library for writing the form (react-hook-form, formik, react-final-form, redux-form)
* The data for the inputs does not have to be stored in a reducer (but you are allowed to if you so choose)
* The submit-button should be disabled when you are sending the post to the server
* The input-fields should be disabled when you are sending the post to the server
* There should be a loading-indicator (spinner or text) when sending the post to the server
* After posting to the server is finished, either redirect to the List View or the Detail view of the post you just posted
* Ask another trainee for a review
* Process any feedback you get (only if you agree with the feedback)
* Finished? Ask me for a review

{% hint style="info" %}
Are you stuck? Feel free to ask me anything. I am here to help
{% endhint %}

{% hint style="warning" %}
Please do not continue until I have finished my review
{% endhint %}
