How to decouple JSX out of JavaScript in React?

Posted by Jessica Taylor | Updated on | Reactjs


If you want to decouple JSX out of JavaScript in React? Here is a pattern for separating the template jsx that uses CommonJS modules in NodeJS, Browserify or Webpack. In NodeJS, I found the node-jsx …

Disable back button in react navigation

Posted by Jessica Taylor | Updated on | Reactjs


Disable back button in react navigationTo make the back button disappear: If you want to clean navigation stack too, you can do something like this (assuming you are on the screen from which you want …

How to manually trigger click event in ReactJS?

Posted by Jessica Taylor | Updated on | Reactjs


If you want to manually trigger click event in ReactJS? You could use the ref prop to acquire a reference to the underlying HTMLInputElement object through a callback, store the reference as a class property, …

Active link with React-Router?

Posted by Jessica Taylor | Updated on | Reactjs


Active link with React-Router? no longer has the activeClassName or activeStyle properties. In react-router v4 you have to use if you want to do conditional styling: I added an exact property to the home , …

How to send the bearer token with axios?

Posted by Jessica Taylor | Updated on | Reactjs


Want to send the bearer token with axios? The first parameter is the URL. The second is the JSON body that will be sent along your request.

How to cancel a fetch on componentWillUnmount?

Posted by Jessica Taylor | Updated on | Reactjs


If you want to cancel a fetch on componentWillUnmount? When you fire a Promise it might take a few seconds before it resolves and by that time user might have navigated to another place in …

Reactjs async rendering of components

Posted by Jessica Taylor | Updated on | Reactjs


Reactjs async rendering of components There are two ways to handle this, and which you choose depends on which component should own the data and the loading state. Step 1. Move the Ajax request into …

How to include code only on specific pages in WordPress?

Posted by Jessica Taylor | Updated on | WordPress


How to include code only on specific pages in WordPress? Use get_shortcode_regex() function several times in this thread, I just thought I give an example on how to use it. The code is pretty much …

How to use template file for a specific url without creating a page?

Posted by Jessica Taylor | Updated on | WordPress


Want to use template file for a specific url without creating a page in WordPress? Use following code in your theme’s functions.php file OR in site specific plugin.

How to change posts per page count in WordPress?

Posted by Jessica Taylor | Updated on | WordPress


If you want to change posts per page count in WordPress? Use following code in your theme’s functions.php file OR in site specific plugin.

How to enqueue JavaScripts in a plugin in WordPress?

Posted by Jessica Taylor | Updated on | WordPress


How to enqueue JavaScripts in a plugin in WordPress? To load the script in frontend, use wp_enqueue_scripts action (which is not the same that wp_enqueue_script() function:

How to get the the top-level parent of a custom taxonomy term?

Posted by Jessica Taylor | Updated on | WordPress


If you want to get the the top-level parent of a custom taxonomy term? The first function below, get_term_top_most_parent, accepts a term and taxonomy and returns the the term’s top-level parent (or the term itself, …

How to highlight search terms without plugin?

Posted by Jessica Taylor | Updated on | WordPress


Want to highlight search terms without plugin in WordPress? Use following code in your theme’s functions.php file OR in site specific plugin.

How to add class to anchors in WordPress menu?

Posted by Jessica Taylor | Updated on | WordPress


If you want to add class to anchors in WordPress menu? Use following code in your theme’s functions.php file OR in site specific plugin. To avoid using the WordPress menu UI to add classes to …

Showing custom taxonomy column in custom posts type listings

Posted by Jessica Taylor | Updated on | WordPress


In this example, I have share how to showing custom taxonomy column in custom posts type listings in WordPress. You can use the manage_post-type_custom_column and manage_edit_post-type_columns filters to add your taxonomy column to the post …