We can pass a reference to functions as properties from on components(parent) to children components.

To do that let us first inside our parent component let us define a function called eventHandle that will be called to handle a certain event say a button click somewhere in one of the children components.

function eventHandler(){   //some code}

We then pass our eventHandler method to a child component via props as follow

<childComponent   click={eventHandler}/>

Now we can use it inside the child component as follows by using the click prop that was passed down from the parent as a prop and set it as a reference to the eventHandler as follows,

<button onClick={click}>Click Me<\button>

This pattern helps us to change state from components that we do not have direct access to the state

Photo by Christopher Gower

The anatomy of React components.

Components are the core building block of React apps. React is a library for creating components. A react application is a component tree starting from one single parent component and nesting more other subcomponents up to infinity per application need. Each component needs to return/ render some JSX code — it defines which HTML code React should render to the real DOM in the end. JSX is NOT HTML but it looks a lot like it. Differences can be seen when looking closely though (for example className in JSX vs class in “normal HTML”). JSX is just syntactic sugar for…

This weekend I had some time to reflect on my personal goals and my life in general and I came to realize that I am losing focus a lot and I am somehow failing to stick to my goals and plans. My main goal is to better at coding, learn the craft and eventually make a living out of it. …

A function is a block of code that can be executed to perform a certain action, In Javascript, we have an anonymous function which as its name suggests it is anonymous(Does not have a name) and a normal function that contains a name that can be used to call the function for it to execute but that is another story for another day since this is a note about higher-order functions we will now focus on Higher-order functions.

A higher-order function is a function that has multi-levels ie. it can take another function as an input or it can give…

Today marks the 10 days of my #100daysofcode challenge, A challenge I decided to take to bring my brain up to speed with code after 6 months of not coding.

To make this effective I had to take on real-life projects as a way of avoiding the tutorial hell that I recall going through back in the days when I was starting to engage with this lifelong learning career called code. Also, figure this would be the best way to face the imposter syndrome that had been holding me back for sometime

Well here are some of the lessons I…

As a full stack web developer most of the time I have been faced with a task of developing a site from scratch. This process in early days of my career seemed to be a mountain climbing journey but thankful with time and a lot of trials and errors I have come to realize what works and what doesn’t and the shortest way(or at least the right path) to take from idea, design to implementation of a web development project.

So today I would like to share some steps that we take to develop and design a website at kodemunit.com

So today I had a chance to attend an Entrepreneurship event and I would like to share few among many lessons I learned. The even was organised by Tony Elumelu Foundation and United Bank For Africa with the aim of inspiring and mobilizing Tanzania Entrepreneurs to apply for the Seed funding on the current TEF cohort if you do not know what that is you can check it here https://www.tonyelumelufoundation.org/

We had many entrepreneurs the auditorium was full and the organizers had not expected this,Mr Joseph Kusaga founder of the CLOUDS Entertainment Limited was the main speaker as well Mr…

Image Credit:Bongolive.co.tz

Hello again, Recently i discovered the power that lies in bulk sms marketing after approaching a number of telecoms and seeing how difficult it was to work with them i decide to look for another option bulk sms service providers, which lead me to the discovery of Bongolive.co.tz, and i must say this guys are the best in bulk sms.

Now to cut the blah blahs shot, in this blog post i am going to share with you step by step how you can use their bulk sms api to send sms to large number of people using javascript’s nodejs…

Probably you are already wondering ‘what is Bulk SMS?’ the acronym SMS stands for Short Message Service it is a text message sent from one mobile phone to another, Bulk SMS is therefore sending a single message to a large number of recipients all at once.

Bulk SMS service,or Business SMS as they are sometimes referred,Bulk SMS can be used by business owners, community groups, marketing agencies or anyone wishing to communicate with a large group of people.

In this post I will be sharing with you why and how as a business organisation you can also get started with…

Wow, guess what :) the news came out that we are going for the #GrandFinale meetup in the ALCwithGoogle scholarship, you know what that means? okay if you don’t worry not I will tell you, but before I do that let me walk you through the whole ALCwithGoogle Scholarship, an amazing period of Grow with Google, Andela, and Pluralsight.

I was privileged to be one of many African learners that participated in this 100% online scholarship I must confess that for me this was a real period of growth from being afraid of framework and libraries to actually creating APIs…

Justine Peterson Mahinyila

Infinity Leaner(Coder), businessman, software developer, a writer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store