Correct modification of state arrays in React.js

The React docs says: Treat this.state as if it were immutable. Your push will mutate the state directly and that could potentially lead to error prone code, even if you are “resetting” the state again afterwards. F.ex, it could lead to that some lifecycle methods like componentDidUpdate won’t trigger. The recommended approach in later React … Read more

Default text on input

In modern browsers, you may set the placeholder attribute on a field to set its default text. However, in older browsers, you may use JavaScript to capture the focus and blur events: Demo: http://jsbin.com/utecu

Ajax success function

It is because Ajax is asynchronous, the success or the error function will be called later, when the server answer the client. So, just move parts depending on the result into your success function like that :

Wildcard string comparison in Javascript

I think you meant something like “*” (star) as a wildcard for example: “a*b” => everything that starts with “a” and ends with “b” “a*” => everything that starts with “a” “*b” => everything that ends with “b” “*a*” => everything that has an “a” in it “*a*b*”=> everything that has an “a” in it, … Read more